Interface Traversable<T>

Type Parameters:
T - type of the elements in the Traversable
All Superinterfaces:
AutoCloseable, Iterable<T>

public interface Traversable<T> extends Iterable<T>, AutoCloseable
Defines the contract for Traversable.
  • Method Details

    • empty

      static <S> Traversable<S> empty()
      Returns an empty instance.
      Returns:
      the result of empty
    • from

      static <S> Traversable<S> from(Iterable<S> iterable)
      Creates an instance from the provided source.
      Parameters:
      iterable - the iterable value
      Returns:
      the result of from
    • from

      @SafeVarargs static <S> Traversable<S> from(S first, S... others)
      Creates an instance from the provided source.
      Parameters:
      first - the first value
      others - the others value
      Returns:
      the result of from
    • from

      static <S> Traversable<S> from(Enumerable<S> enumerable)
      Creates an instance from the provided source.
      Parameters:
      enumerable - the enumerable value
      Returns:
      the result of from
    • from

      static <S> Traversable<S> from(Stream<S> stream)
      Creates an instance from the provided source.
      Parameters:
      stream - the stream value
      Returns:
      the result of from
    • map

      default <R> Traversable<R> map(Function<T,R> mapper)
      Performs map.
      Parameters:
      mapper - the mapper value
      Returns:
      the result of map
    • flatMap

      default <R> Traversable<R> flatMap(Function<T,Traversable<R>> mapper)
      Performs flatMap.
      Parameters:
      mapper - the mapper value
      Returns:
      the result of flatMap
    • concat

      default Traversable<T> concat(Traversable<T> other)
      Performs concat.
      Parameters:
      other - the other value
      Returns:
      the result of concat
    • zip

      default <O, R> Traversable<R> zip(Traversable<O> other, BiFunction<T,O,R> zipper)
      Performs zip.
      Parameters:
      other - the other value
      zipper - the zipper value
      Returns:
      the result of zip
    • collect

      default <R, A> R collect(Collector<T,A,R> collector)
      Performs collect.
      Parameters:
      collector - the collector value
      Returns:
      the result of collect
    • close

      void close()
      Performs close.
      Specified by:
      close in interface AutoCloseable