Class Vect<E>

java.lang.Object
io.immutables.common.Vect<E>
Type Parameters:
E - element type
All Implemented Interfaces:
Foldable<E>, Iterable<E>

public final class Vect<E> extends Object implements Iterable<E>, Foldable<E>
Minimalistic wrapper around immutable array. We use it over ImmutableList because we want monomorphic call sites, no unsupported mutation methods, minimum memory overhead, no views, have simplistic pattern matching capability and short classname.
  • Method Details

    • iterator

      public Vect<E>.Iterator iterator()
      Specified by:
      iterator in interface Iterable<E>
    • mapIndex

      public <R> Vect<R> mapIndex(BiFunction<Integer,? super E,? extends R> to)
    • map

      public <R> Vect<R> map(Function<? super E,? extends R> to)
    • flatMap

      public <R> Vect<R> flatMap(Function<? super E,? extends Iterable<R>> to)
    • findFirst

      public Optional<E> findFirst(Predicate<? super E> is)
    • some

      public boolean some(Predicate<? super E> is)
    • all

      public boolean all(Predicate<? super E> is)
    • contains

      public boolean contains(E element)
    • forEach

      public void forEach(Consumer<? super E> consumer)
      Specified by:
      forEach in interface Iterable<E>
    • only

      public <T> Vect<T> only(Class<T> type)
    • takeWhile

      public Vect<E> takeWhile(Predicate<? super E> predicate)
    • dropWhile

      public Vect<E> dropWhile(Predicate<? super E> predicate)
    • bipartition

      public <R> R bipartition(Predicate<? super E> predicate, BiFunction<Vect<E>,Vect<E>,R> receiver)
    • filter

      public Vect<E> filter(Predicate<? super E> is)
    • fold

      public <A> A fold(A left, BiFunction<A,E,A> folder)
      Specified by:
      fold in interface Foldable<E>
    • fold

      public <A> A fold(BiFunction<E,A,A> reducer, A right)
      Specified by:
      fold in interface Foldable<E>
    • prepend

      public Vect<E> prepend(E element)
    • append

      public Vect<E> append(E element)
    • sort

      public Vect<E> sort()
    • sort

      public Vect<E> sort(Comparator<? super E> comparator)
    • reverse

      public Vect<E> reverse()
    • reduce

      public E reduce(BiFunction<E,E,E> reducer)
      Specified by:
      reduce in interface Foldable<E>
    • range

      public Vect<E> range(int from, int to)
    • rangeFrom

      public Vect<E> rangeFrom(int from)
    • first

      public E first()
    • last

      public E last()
    • get

      public E get(int index)
    • size

      public int size()
    • isEmpty

      public boolean isEmpty()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • spliterator

      public Spliterator<E> spliterator()
      Specified by:
      spliterator in interface Iterable<E>
    • stream

      public Stream<E> stream()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • join

      public String join(String separator)
    • join

      public String join(String separator, String prefix, String suffix)
    • concat

      public Vect<E> concat(Vect<? extends E> v)
    • toArray

      public Object[] toArray()
    • toArray

      public E[] toArray(E[] a)
    • toArray

      public E[] toArray(IntFunction<E[]> factory)
    • of

      public static <E> Vect<E> of(E single)
    • of

      public static <E> Vect<E> of(E first, E second)
    • of

      public static <E> Vect<E> of(E first, E second, E third)
    • of

      public static <E> Vect<E> of(E first, E second, E third, E fourth)
    • of

      public static <E> Vect<E> of(E first, E second, E third, E fourth, E fifth)
    • of

      @SafeVarargs public static <E> Vect<E> of(E... elements)
    • of

      public static <E> Vect<E> of()
    • from

      @Deprecated public static <E> Vect<E> from(Vect<? extends E> vector)
      Deprecated.
    • from

      public static <E> Vect<E> from(Iterable<? extends E> iterable)
    • builder

      public static <E> Vect.Builder<E> builder()
    • builderWithExpectedSize

      public static <E> Vect.Builder<E> builderWithExpectedSize(int size)
    • when

      public <R> Vect<E>.When<R> when()
    • to

      public static <E> Collector<E,Vect.Builder<E>,Vect<E>> to()