Class Iterables


  • public final class Iterables
    extends Object
    Static utility methods for Iterable.
    Author:
    Martin Kouba
    • Method Detail

      • addAll

        public static <T> boolean addAll​(Collection<T> target,
                                         Iterable<? extends T> iterable)
        Add all elements in the iterable to the collection.
        Parameters:
        target -
        iterable -
        Returns:
        true if the target was modified, false otherwise
      • concat

        public static <T> Iterable<T> concat​(Iterable<? extends Iterable<? extends T>> iterables)
        Combine the iterables into a single one.
        Parameters:
        iterables -
        Returns:
        a single combined iterable
      • concat

        public static <T> Iterable<T> concat​(Iterable<? extends T> a,
                                             Iterable<? extends T> b)
        Combine the iterables into a single one.
      • iterators

        public static <T> Iterator<Iterator<? extends T>> iterators​(Iterable<? extends Iterable<? extends T>> iterables)
        Parameters:
        iterables -
        Returns:
        an iterator over iterators from the given iterable of iterables
      • transform

        public static <T,​R> Iterable<R> transform​(Iterable<T> iterable,
                                                        Function<? super T,​? extends R> function)