/** * Flattens iterable-of-iterables and returns iterable over the * elements of the inner collections. This method doesn't create any * new collections or copies any elements. * * @param c Input collection of collections. * @param <T> Type of the inner collections. * @return Iterable over the elements of the inner collections. */ public static <T> GridIterator<T> flat(@Nullable final Iterable<? extends Iterable<T>> c) { return isEmpty(c) ? GridFunc.<T>emptyIterator() : new FlatIterator<T>(c); }
/** * Flattens iterable-of-iterators and returns iterator over the * elements of the inner collections. This method doesn't create any * new collections or copies any elements. * * @param c Input iterable of iterators. * @return Iterator over the elements of given iterators. */ public static <T> Iterator<T> flatIterators(@Nullable final Iterable<Iterator<T>> c) { return isEmpty(c) ? GridFunc.<T>emptyIterator() : new FlatIterator<T>(c); }
/** * Flattens iterable-of-iterables and returns iterable over the * elements of the inner collections. This method doesn't create any * new collections or copies any elements. * * @param c Input collection of collections. * @param <T> Type of the inner collections. * @return Iterable over the elements of the inner collections. */ public static <T> GridIterator<T> flat(@Nullable final Iterable<? extends Iterable<T>> c) { return isEmpty(c) ? GridFunc.<T>emptyIterator() : new FlatIterator<T>(c); }
/** * Flattens iterable-of-iterators and returns iterator over the * elements of the inner collections. This method doesn't create any * new collections or copies any elements. * * @param c Input iterable of iterators. * @return Iterator over the elements of given iterators. */ public static <T> Iterator<T> flatIterators(@Nullable final Iterable<Iterator<T>> c) { return isEmpty(c) ? GridFunc.<T>emptyIterator() : new FlatIterator<T>(c); }