File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
src/main/java/org/apache/maven/plugin/compiler Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change 2020
2121import java .util .Collection ;
2222import java .util .Collections ;
23- import java .util .List ;
24- import java .util .stream . Collectors ;
23+ import java .util .Set ;
24+ import java .util .TreeSet ;
2525
2626/**
2727 * Show the modifications between two lists.
2828 */
29- final class DeltaList <E > {
29+ final class DeltaList <E extends Comparable < E > > {
3030
31- private final List <E > added ;
32- private final List <E > removed ;
31+ private final Set <E > added = new TreeSet <>() ;
32+ private final Set <E > removed = new TreeSet <>() ;
3333 private final boolean hasChanged ;
3434
3535 DeltaList (Collection <E > oldList , Collection <E > newList ) {
36- this .added = newList .stream ().filter (i -> !oldList .contains (i )).sorted ().collect (Collectors .toList ());
37- this .removed =
38- oldList .stream ().filter (i -> !newList .contains (i )).sorted ().collect (Collectors .toList ());
36+ for (E newListItem : newList ) {
37+ if (!oldList .contains (newListItem )) {
38+ added .add (newListItem );
39+ }
40+ }
41+ for (E oldListItem : oldList ) {
42+ if (!newList .contains (oldListItem )) {
43+ removed .add (oldListItem );
44+ }
45+ }
3946 this .hasChanged = !added .isEmpty () || !removed .isEmpty ();
4047 }
4148
You can’t perform that action at this time.
0 commit comments