Skip to content

Commit a8bb20f

Browse files
dr0icboehme
authored andcommitted
Use Collections.emptySet() and return Set instead of List
1 parent ff6a042 commit a8bb20f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/org/culturegraph/mf/util/tries/WildcardTrie.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public List<P> get(final String key) {
113113

114114
List<P> matches = Collections.emptyList();
115115
for (Node<P> node : nodes) {
116-
final List<P> values = node.getValues();
116+
final Set<P> values = node.getValues();
117117
if (!values.isEmpty()) {
118118
if (matches == Collections.emptyList()) {
119119
matches = new ArrayList<P>();
@@ -132,7 +132,7 @@ public List<P> get(final String key) {
132132
*/
133133
private final class Node<T> {
134134

135-
private LinkedHashSet<T> values = new LinkedHashSet<T>();
135+
private Set<T> values = Collections.emptySet();
136136
private final CharMap<Node<T>> links = new CharMap<Node<T>>();
137137

138138
protected Node() {
@@ -149,14 +149,14 @@ public Node<T> addNext(final char key) {
149149
}
150150

151151
public void addValue(final T value) {
152-
if (values == Collections.emptyList()) {
152+
if (values == Collections.emptySet()) {
153153
values = new LinkedHashSet<T>();
154154
}
155155
this.values.add(value);
156156
}
157157

158-
public List<T> getValues() {
159-
return new LinkedList<T>(values);
158+
public Set<T> getValues() {
159+
return values;
160160
}
161161

162162
public Node<T> getNext(final char key) {

0 commit comments

Comments
 (0)