Package io.vavr

Interface Iterable<T>

    • Method Summary

      Modifier and Type Method Description
      Iterator<T> iterator()
      Returns a rich Iterator that allows us to perform intermediate, sequential operations known from Vavr's collection library.
      default <C> C to​(java.util.function.Function<? super java.lang.Iterable<T>,​C> fromIterable)
      A generic conversion function.
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Method Detail

      • iterator

        Iterator<T> iterator()
        Returns a rich Iterator that allows us to perform intermediate, sequential operations known from Vavr's collection library.
        Specified by:
        iterator in interface java.lang.Iterable<T>
        Returns:
        an Iterator instance (that might be a singleton in the empty case)
      • to

        default <C> C to​(java.util.function.Function<? super java.lang.Iterable<T>,​C> fromIterable)
        A generic conversion function.

        Example:

        
         List<Integer> list = Option.some(1).to(List::ofAll);
         
        Type Parameters:
        C - the target type of the conversion
        Parameters:
        fromIterable - A function that converts a Iterable to some type C.
        Returns:
        a new instance of type C that must not be null per contract