relevant method chain completion: don't add items to unmodifiable collection (EA-102737)

This commit is contained in:
Dmitry Batkovich
2017-06-08 14:46:43 +03:00
parent 925d97acdb
commit 2255c3bfcf
@@ -48,7 +48,7 @@ public class ChainSearcher {
if (methods == null) {
methods = currentMethods;
} else {
methods.addAll(currentMethods);
methods = unionSortedSet(currentMethods, methods);
}
}
return new SearchInitializer(methods, context);
@@ -169,4 +169,13 @@ public class ChainSearcher {
result.add(newChain);
}
}
private static <T> SortedSet<T> unionSortedSet(SortedSet<T> s1, SortedSet<T> s2) {
if (s1.isEmpty()) return s2;
if (s2.isEmpty()) return s1;
TreeSet<T> result = new TreeSet<>();
result.addAll(s1);
result.addAll(s2);
return result;
}
}