File tree Expand file tree Collapse file tree 1 file changed +7
-19
lines changed
vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl Expand file tree Collapse file tree 1 file changed +7
-19
lines changed Original file line number Diff line number Diff line change 15
15
*/
16
16
package software .xdev .vaadin .utl ;
17
17
18
- import java .util .ArrayList ;
19
- import java .util .Comparator ;
20
18
import java .util .List ;
19
+ import java .util .stream .Collectors ;
21
20
22
21
import software .xdev .vaadin .model .ChipBadge ;
23
22
import software .xdev .vaadin .model .ChipBadgeExtension ;
@@ -41,22 +40,11 @@ public boolean equalLists(
41
40
final List <ChipBadgeExtension <FilterCondition <T , ?>>> one ,
42
41
final List <ChipBadgeExtension <FilterCondition <T , ?>>> two )
43
42
{
44
- if (one == null && two == null )
45
- {
46
- return true ;
47
- }
48
-
49
- if (one == null || two == null || one .size () != two .size ())
50
- {
51
- return false ;
52
- }
53
-
54
- // to avoid messing the order of the lists we will use a copy
55
- final List <ChipBadgeExtension <FilterCondition <T , ?>>> oneCopy = new ArrayList <>(one );
56
- final List <ChipBadgeExtension <FilterCondition <T , ?>>> twoCopy = new ArrayList <>(two );
57
-
58
- oneCopy .sort (Comparator .comparing (ChipBadge ::getBadgeId ));
59
- twoCopy .sort (Comparator .comparing (ChipBadge ::getBadgeId ));
60
- return one .equals (two );
43
+ return one .stream ()
44
+ .map (ChipBadge ::getBadgeId )
45
+ .collect (Collectors .toSet ())
46
+ .equals (two .stream ()
47
+ .map (ChipBadge ::getBadgeId )
48
+ .collect (Collectors .toSet ()));
61
49
}
62
50
}
You can’t perform that action at this time.
0 commit comments