public static <T> Iterator<T> concat( Iterator<Iterator<T>> iterators ) { return new CombiningIterator<>( iterators ); }
@Override protected T fetchNextOrNull() { if ( currentIterator == null || !currentIterator.hasNext() ) { while ( (currentIterator = nextIteratorOrNull()) != null ) { if ( currentIterator.hasNext() ) { break; } } } return currentIterator != null && currentIterator.hasNext() ? currentIterator.next() : null; }
@Override public Iterator<T> iterator() { LinkedList<Iterator<T>> iterators = new LinkedList<>(); for ( Iterable<T> iterable : iterables ) { iterators.add( iterable.iterator() ); } return new CombiningIterator<>( iterators ); } }
@Override protected T fetchNextOrNull() { if ( currentIterator == null || !currentIterator.hasNext() ) { while ( (currentIterator = nextIteratorOrNull()) != null ) { if ( currentIterator.hasNext() ) { break; } } } return currentIterator != null && currentIterator.hasNext() ? currentIterator.next() : null; }
public static <FROM, TO> Iterator<TO> flatMap( Function<? super FROM, ? extends Iterator<TO>> function, Iterator<FROM> from ) { return new CombiningIterator<>( map(function, from) ); }
public static <T> Iterator<T> concat( Iterator<Iterator<T>> iterators ) { return new CombiningIterator<>( iterators ); }
@Override public Iterator<T> iterator() { LinkedList<Iterator<T>> iterators = new LinkedList<>(); for ( Iterable<T> iterable : iterables ) { iterators.add( iterable.iterator() ); } return new CombiningIterator<>( iterators ); } }
public static <FROM, TO> Iterator<TO> flatMap( Function<? super FROM, ? extends Iterator<TO>> function, Iterator<FROM> from ) { return new CombiningIterator<>( map(function, from) ); }
@SuppressWarnings( "unchecked" ) public ConfigurationParser( File configFile, String... format ) { this( Iterators.asIterable( new CombiningIterator<String>( Arrays.asList( new LineIterator( configFile ), new ArrayIterator<String>( format ) ) ) ) ); }