Jacqueline Joson 6 лет назад
Родитель
Сommit
8c02b4a46e

+ 6
- 3
src/main/java/rocks/zipcode/io/quiz4/collections/ComparableTreeSet.java Просмотреть файл

@@ -1,21 +1,24 @@
1 1
 package rocks.zipcode.io.quiz4.collections;
2 2
 
3
+import java.util.Comparator;
4
+import java.util.TreeSet;
5
+
3 6
 /**
4 7
  * @author leon on 11/12/2018.
5 8
  */
6
-public class ComparableTreeSet<_> {
9
+public class ComparableTreeSet<_> extends TreeSet<ComparableTreeSet<_>>  implements Comparable <ComparableTreeSet <_>> {
7 10
     private _[] arr;
11
+    private ComparableTreeSet<_> o;
12
+
8 13
     //
9 14
     public ComparableTreeSet(_... arr) {
10 15
         this.arr = arr;
11 16
     }
12 17
 
13
-
14 18
     public ComparableTreeSet() {
15 19
     }
16 20
 
17 21
     public int compareTo(ComparableTreeSet<_> o) {
18 22
         return 0;
19 23
     }
20
-
21 24
 }

+ 17
- 4
src/main/java/rocks/zipcode/io/quiz4/collections/SimpleStringGroup.java Просмотреть файл

@@ -1,15 +1,18 @@
1 1
 package rocks.zipcode.io.quiz4.collections;
2 2
 
3
+import java.util.Iterator;
4
+import java.util.function.Consumer;
5
+
3 6
 /**
4 7
  * @author leon on 11/12/2018.
5 8
  */
6
-public class SimpleStringGroup {
9
+public class SimpleStringGroup implements Iterable{
7 10
     SimpleStringGroup ssg;
8 11
     Integer count;
9 12
 
10
-    public SimpleStringGroup() {
11
-        throw new UnsupportedOperationException("Method not yet implemented");
12
-    }
13
+//    public SimpleStringGroup() {
14
+//        throw new UnsupportedOperationException("Method not yet implemented");
15
+//    }
13 16
 
14 17
     public Integer count() {
15 18
         return count;
@@ -32,4 +35,14 @@ public class SimpleStringGroup {
32 35
 
33 36
     public void clear() {
34 37
     }
38
+
39
+    @Override
40
+    public Iterator iterator() {
41
+
42
+        return null;
43
+    }
44
+
45
+    @Override
46
+    public void forEach(Consumer action) {
47
+    }
35 48
 }

+ 14
- 5
src/main/java/rocks/zipcode/io/quiz4/generics/MyStack.java Просмотреть файл

@@ -1,13 +1,17 @@
1 1
 package rocks.zipcode.io.quiz4.generics;
2 2
 
3
+import java.util.Collection;
4
+import java.util.Iterator;
5
+
3 6
 /**
4 7
  * @author leon on 11/12/2018.
5 8
  */
6
-public class MyStack<SomeType> {
7
-    MyStack<SomeType> myStack = new MyStack<>();
8
-    public MyStack() {
9
-        throw new UnsupportedOperationException("Method not yet implemented");
10
-    }
9
+public class MyStack<SomeType> implements Iterable<SomeType> {
10
+    private int n;
11
+
12
+//    public MyStack() {
13
+//        throw new UnsupportedOperationException("Method not yet implemented");
14
+//    }
11 15
 
12 16
     public Boolean isEmpty() {
13 17
 
@@ -24,4 +28,9 @@ public class MyStack<SomeType> {
24 28
     public SomeType pop() {
25 29
         return null;
26 30
     }
31
+
32
+    @Override
33
+    public Iterator iterator() {
34
+        return null;
35
+    }
27 36
 }