Quellcode durchsuchen

genetic SortedGroup

Nuridalia.Hernandez vor 5 Jahren
Ursprung
Commit
656570d1e4

+ 14
- 1
src/main/java/rocks/zipcode/io/quiz4/generics/SortedGroup.java Datei anzeigen

@@ -1,18 +1,31 @@
1 1
 package rocks.zipcode.io.quiz4.generics;
2 2
 
3
+
4
+import java.util.Collections;
5
+
3 6
 /**
4 7
  * @author leon on 18/12/2018.
5 8
  */
6 9
 public class SortedGroup<_> extends Group<_> {
10
+
11
+
7 12
     @Override
8 13
     public void insert(Object value) {
14
+        myGroup.add((_)value);
15
+        Collections.sort(myGroup,null );
16
+
17
+
9 18
     }
10 19
 
11 20
     @Override
12 21
     public void delete(Object value) {
22
+        myGroup.remove((_)value);
23
+
24
+
13 25
     }
14 26
 
15 27
     public Integer indexOf(_ firstValue) {
16
-        return null;
28
+
29
+        return myGroup.indexOf(firstValue);
17 30
     }
18 31
 }

+ 2
- 2
src/test/java/rocks/zipcode/io/quiz4/generics/sortedgroup/integersortedgroup/IntegerSortedGroupInsertTest.java Datei anzeigen

@@ -2,8 +2,8 @@ package rocks.zipcode.io.quiz4.generics.sortedgroup.integersortedgroup;
2 2
 
3 3
 import org.junit.Assert;
4 4
 import org.junit.Test;
5
-import org.omg.CORBA.INTERNAL;
6
-import rocks.zipcode.io.quiz4.generics.Group;
5
+//import org.omg.CORBA.INTERNAL;
6
+//import rocks.zipcode.io.quiz4.generics.Group;
7 7
 import rocks.zipcode.io.quiz4.generics.SortedGroup;
8 8
 
9 9
 /**