@Test public void returnsPairsWhereAllKeysMatch() { Map<String, Integer> left = new TreeMap<>(); left.put("b", 2); left.put("a", 1); left.put("c", 3); Map<String, String> right = new TreeMap<>(); right.put("a", "apple"); right.put("c", "carrot"); right.put("b", "banana"); KeyMatchingSpliterator<String, Integer, String> spliterator = KeyMatchingSpliterator.over( Comparator.naturalOrder(), left.entrySet().spliterator(), right.entrySet().spliterator(), 0, ""); List<T2<Integer, String>> tuples = StreamSupport.stream(spliterator, false).collect(Collectors.toList()); assertThat(tuples, hasItems(T2.of(1, "apple"), T2.of(2, "banana"), T2.of(3, "carrot"))); }
public static <K, L, R> KeyMatchingSpliterator<K, L, R> over( Comparator<? super K> comparator, Spliterator<Map.Entry<K, L>> self, Spliterator<Map.Entry<K, R>> other, L emptyLeft, R emptyRight) { return new KeyMatchingSpliterator<>(comparator, self, other, emptyLeft, emptyRight); }
KeyMatchingSpliterator implements Spliterator<T2<L, R>> { public static <K, L, R> KeyMatchingSpliterator<K, L, R> over( Comparator<? super K> comparator, Spliterator<Map.Entry<K, L>> self, Spliterator<Map.Entry<K, R>> other, L emptyLeft, R emptyRight) { return new KeyMatchingSpliterator<>(comparator, self, other, emptyLeft, emptyRight); } }
KeyMatchingSpliterator implements Spliterator<T2<L, R>> { public static <K, L, R> KeyMatchingSpliterator<K, L, R> over( Comparator<? super K> comparator, Spliterator<Map.Entry<K, L>> self, Spliterator<Map.Entry<K, R>> other, L emptyLeft, R emptyRight) { return new KeyMatchingSpliterator<>(comparator, self, other, emptyLeft, emptyRight); } KeyMatchingSpliterator(Comparator<? super K> comparator,
                           Spliterator<Map.Entry<K, L>> leftIter,
                           Spliterator<Map.Entry<K, R>> rightIter,
                           L emptyLeft,
                           R emptyRight); }
KeyMatchingSpliterator implements Spliterator<T2<L, R>> { public static <K, L, R> KeyMatchingSpliterator<K, L, R> over( Comparator<? super K> comparator, Spliterator<Map.Entry<K, L>> self, Spliterator<Map.Entry<K, R>> other, L emptyLeft, R emptyRight) { return new KeyMatchingSpliterator<>(comparator, self, other, emptyLeft, emptyRight); } KeyMatchingSpliterator(Comparator<? super K> comparator,
                           Spliterator<Map.Entry<K, L>> leftIter,
                           Spliterator<Map.Entry<K, R>> rightIter,
                           L emptyLeft,
                           R emptyRight); static KeyMatchingSpliterator<K, L, R> over(
            Comparator<? super K> comparator,
            Spliterator<Map.Entry<K, L>> self,
            Spliterator<Map.Entry<K, R>> other,
            L emptyLeft,
            R emptyRight); @Override boolean tryAdvance(Consumer<? super T2<L, R>> action); @Override Spliterator<T2<L, R>> trySplit(); @Override long estimateSize(); @Override int characteristics(); }
KeyMatchingSpliterator implements Spliterator<T2<L, R>> { public static <K, L, R> KeyMatchingSpliterator<K, L, R> over( Comparator<? super K> comparator, Spliterator<Map.Entry<K, L>> self, Spliterator<Map.Entry<K, R>> other, L emptyLeft, R emptyRight) { return new KeyMatchingSpliterator<>(comparator, self, other, emptyLeft, emptyRight); } KeyMatchingSpliterator(Comparator<? super K> comparator,
                           Spliterator<Map.Entry<K, L>> leftIter,
                           Spliterator<Map.Entry<K, R>> rightIter,
                           L emptyLeft,
                           R emptyRight); static KeyMatchingSpliterator<K, L, R> over(
            Comparator<? super K> comparator,
            Spliterator<Map.Entry<K, L>> self,
            Spliterator<Map.Entry<K, R>> other,
            L emptyLeft,
            R emptyRight); @Override boolean tryAdvance(Consumer<? super T2<L, R>> action); @Override Spliterator<T2<L, R>> trySplit(); @Override long estimateSize(); @Override int characteristics();  }