Class Iterables


  • public final class Iterables
    extends java.lang.Object
    Some fancy utilities for iterables, e.G. conversions from and to iterators.
    Author:
    thomas.jungblut
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <K,​V>
      de.jungblut.math.tuple.Tuple<K,​V>
      consumeNext​(java.util.Iterator<K> it, java.util.Iterator<V> it2)
      Consumes the next entries from a parallel interator.
      static <T> java.lang.Iterable<T> from​(java.util.Iterator<T> iterator)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • from

        public static <T> java.lang.Iterable<T> from​(java.util.Iterator<T> iterator)
        Returns:
        a new iterable that returns the given iterator.
      • consumeNext

        public static <K,​V> de.jungblut.math.tuple.Tuple<K,​V> consumeNext​(java.util.Iterator<K> it,
                                                                                      java.util.Iterator<V> it2)
        Consumes the next entries from a parallel interator.
        Parameters:
        it - the left iterator.
        it2 - the right iterator.
        Returns:
        a tuple. This tuple can have either of its two entries as NULL once the end of one iterator has been reached. If both iterators are at their end it simply returns null.