Class IterableView<T>

  • All Implemented Interfaces:
    Iterable<T>

    public abstract class IterableView<T>
    extends com.google.common.collect.ForwardingObject
    implements Iterable<T>
    A wrapper for an iterable that gives it super chaining powers. And a nice toString.
    • Constructor Detail

      • IterableView

        public IterableView()
    • Method Detail

      • delegate

        protected abstract Iterable<? extends T> delegate()
        Specified by:
        delegate in class com.google.common.collect.ForwardingObject
      • of

        public static <T> IterableView<T> of​(T... elements)
      • filter

        public IterableView<T> filter​(com.google.common.base.Predicate<? super T> predicate)
      • transform

        public <U> IterableView<U> transform​(com.google.common.base.Function<? super T,​? extends U> function)
      • unmodifiableIterable

        public IterableView<T> unmodifiableIterable()
      • contains

        public boolean contains​(@Nullable
                                Object element)
      • find

        public T find​(com.google.common.base.Predicate<? super T> predicate)
      • frequency

        public int frequency​(@Nullable
                             Object element)
      • size

        public int size()
      • all

        public boolean all​(com.google.common.base.Predicate<? super T> predicate)
      • any

        public boolean any​(com.google.common.base.Predicate<? super T> predicate)
      • isEmpty

        public boolean isEmpty()
      • get

        public T get​(int position)
      • get

        public T get​(int position,
                     @Nullable
                     T defaultValue)
      • getLast

        public T getLast()
      • getLast

        public T getLast​(@Nullable
                         T defaultValue)
      • getOnlyElement

        public T getOnlyElement()
      • getOnlyElement

        public T getOnlyElement​(@Nullable
                                T defaultValue)
      • getFirst

        public T getFirst()
      • immutableCopy

        public com.google.common.collect.ImmutableList<T> immutableCopy()
        Returns an immutable copy of the current contents of this iterable view. Does not support null elements.
      • immutableSetCopy

        public com.google.common.collect.ImmutableSet<T> immutableSetCopy()
        Returns an immutable copy of the current contents of this iterable view. Does not support null elements.
      • copyInto

        public <S extends Collection<? super T>> S copyInto​(S collection)
        Copies the current contents of this set view into an existing collection. This method has equivalent behavior to Iterables.addAll(collection, this).
        Returns:
        a reference to set, for convenience
      • stream

        public Stream<T> stream()
        Returns a sequential Stream with the contents as its source.
      • toString

        public String toString()
        Overrides:
        toString in class com.google.common.collect.ForwardingObject