Example #1
0
 @Override
 public <U> Vector<Tuple2<T, U>> zipAll(java.lang.Iterable<U> that, T thisElem, U thatElem) {
   Objects.requireNonNull(that, "that is null");
   HashArrayMappedTrie<Integer, Tuple2<T, U>> result = HashArrayMappedTrie.empty();
   Iterator<T> list1 = iterator();
   java.util.Iterator<U> list2 = that.iterator();
   while (list1.hasNext() || list2.hasNext()) {
     final T elem1 = list1.hasNext() ? list1.next() : thisElem;
     final U elem2 = list2.hasNext() ? list2.next() : thatElem;
     result = result.put(result.size(), Tuple.of(elem1, elem2));
   }
   return result.isEmpty() ? empty() : new Vector<>(result);
 }
Example #2
0
 @Override
 public <U> Vector<Tuple2<T, U>> zip(java.lang.Iterable<U> that) {
   Objects.requireNonNull(that, "that is null");
   HashArrayMappedTrie<Integer, Tuple2<T, U>> result = HashArrayMappedTrie.empty();
   Iterator<T> list1 = iterator();
   java.util.Iterator<U> list2 = that.iterator();
   while (list1.hasNext() && list2.hasNext()) {
     result = result.put(result.size(), Tuple.of(list1.next(), list2.next()));
   }
   return result.isEmpty() ? empty() : new Vector<>(result);
 }
 @Override
 public boolean hasNext() {
   return iterator.hasNext();
 }