Browse Source

finishe dall except parameterization

Jennifer Chao 6 years ago
parent
commit
9f656518b2
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      src/main/java/com/zipcodewilmington/generic/group/Group.java

+ 5
- 3
src/main/java/com/zipcodewilmington/generic/group/Group.java View File

@@ -3,6 +3,7 @@ package com.zipcodewilmington.generic.group;
3 3
 import com.zipcodewilmington.generic.identifiables.IdentifiableInterface;
4 4
 
5 5
 import java.io.Serializable;
6
+import java.lang.reflect.Type;
6 7
 import java.util.ArrayList;
7 8
 import java.util.List;
8 9
 import java.util.function.Predicate;
@@ -12,7 +13,8 @@ import java.util.stream.Stream;
12 13
 /**
13 14
  * @author leon on 06/12/2018.
14 15
  */
15
-public class Group<TypeOfId, TypeOfEntity extends IdentifiableInterface> extends AbstractGroup{
16
+public class Group<TypeOfId extends Serializable,
17
+        TypeOfEntity extends IdentifiableInterface> extends AbstractGroup{
16 18
 
17 19
     List<TypeOfEntity> list = new ArrayList<>();
18 20
 
@@ -51,8 +53,8 @@ public class Group<TypeOfId, TypeOfEntity extends IdentifiableInterface> extends
51 53
     }
52 54
 
53 55
     @Override
54
-    public List filter(Predicate predicate) {
55
-        return (List) Stream.of(list).filter(predicate).collect(Collectors.toList());
56
+    public List<TypeOfEntity> filter(Predicate predicate) {
57
+        return (List<TypeOfEntity>) list.stream().filter(predicate).collect(Collectors.toList());
56 58
     }
57 59
 
58 60
     @Override