1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugin.compiler;
20
21 import java.util.ArrayList;
22 import java.util.Collection;
23 import java.util.Collections;
24 import java.util.List;
25
26
27
28
29 final class DeltaList<E> {
30
31 private final List<E> added;
32 private final List<E> removed;
33 private final boolean hasChanged;
34
35 DeltaList(Collection<E> oldList, Collection<E> newList) {
36 this.added = new ArrayList<>(newList);
37 this.removed = new ArrayList<>(oldList);
38 added.removeAll(oldList);
39 removed.removeAll(newList);
40 this.hasChanged = !added.isEmpty() || !removed.isEmpty();
41 }
42
43 Collection<E> getAdded() {
44 return Collections.unmodifiableCollection(added);
45 }
46
47 Collection<E> getRemoved() {
48 return Collections.unmodifiableCollection(removed);
49 }
50
51 boolean hasChanged() {
52 return hasChanged;
53 }
54 }