diff --git a/source/net/yacy/kelondro/util/SetTools.java b/source/net/yacy/kelondro/util/SetTools.java index 96a38445a..450e9cd61 100644 --- a/source/net/yacy/kelondro/util/SetTools.java +++ b/source/net/yacy/kelondro/util/SetTools.java @@ -169,10 +169,10 @@ public final class SetTools { @SuppressWarnings("unchecked") private static SortedMap joinConstructiveByEnumeration(final SortedMap map1, final SortedMap map2, final boolean concatStrings) { // implement pairwise enumeration - final Comparator comp = map1.comparator(); + final Comparator comp = map1.comparator() == null ? (Comparator) Comparator.naturalOrder() : map1.comparator(); final Iterator> mi1 = map1.entrySet().iterator(); final Iterator> mi2 = map2.entrySet().iterator(); - final SortedMap result = new TreeMap(map1.comparator()); + final SortedMap result = new TreeMap(comp); int c; if ((mi1.hasNext()) && (mi2.hasNext())) { Map.Entry mentry1 = mi1.next(); @@ -263,6 +263,8 @@ public final class SetTools { * @return true if the small set is completely included in the large set */ public static boolean totalInclusion(final Iterator small, final Set large) { + if (small == null) return true; + if (large == null) return false; while (small.hasNext()) { if (!large.contains(small.next())) return false; } @@ -276,6 +278,8 @@ public final class SetTools { * @return true if the small set is completely included in the large set */ public static boolean totalInclusion(final HandleSet small, final HandleSet large) { + if (small == null) return true; + if (large == null) return false; for (byte[] handle: small) { if (!large.has(handle)) return false; }