Class PrimitiveList<B,A,L extends PrimitiveList<B,A,L>>

java.lang.Object
com.landawn.abacus.util.PrimitiveList<B,A,L>
Type Parameters:
B -
A -
L -
All Implemented Interfaces:
Serializable, RandomAccess
Direct Known Subclasses:
BooleanList, ByteList, CharList, DoubleList, FloatList, IntList, LongList, ShortList

public abstract class PrimitiveList<B,A,L extends PrimitiveList<B,A,L>> extends Object implements RandomAccess, Serializable
Since:
0.8
Author:
Haiyang Li
See Also:
  • Constructor Details

    • PrimitiveList

      public PrimitiveList()
  • Method Details

    • array

      @Deprecated @Beta public abstract A array()
      Deprecated.
      should call toArray()
      Returned the backed array.
      Returns:
    • addAll

      public abstract boolean addAll(L c)
      Parameters:
      c -
      Returns:
    • addAll

      public abstract boolean addAll(int index, L c)
      Parameters:
      index -
      c -
      Returns:
    • addAll

      public abstract boolean addAll(A a)
      Parameters:
      a -
      Returns:
    • addAll

      public abstract boolean addAll(int index, A a)
      Parameters:
      index -
      a -
      Returns:
    • removeAll

      public abstract boolean removeAll(L c)
      Parameters:
      c -
      Returns:
    • removeAll

      public abstract boolean removeAll(A a)
      Parameters:
      a -
      Returns:
    • removeDuplicates

      public abstract boolean removeDuplicates()
      Returns:
    • retainAll

      public abstract boolean retainAll(L c)
      Parameters:
      c -
      Returns:
    • retainAll

      public abstract boolean retainAll(A a)
      Parameters:
      a -
      Returns:
    • deleteAll

      public abstract void deleteAll(int... indices)
      Parameters:
      indices -
    • deleteRange

      public abstract void deleteRange(int fromIndex, int toIndex)
      Parameters:
      fromIndex -
      toIndex -
    • moveRange

      public abstract void moveRange(int fromIndex, int toIndex, int newPositionStartIndex)
      Parameters:
      fromIndex -
      toIndex -
      newPositionStartIndex -
    • replaceRange

      public abstract void replaceRange(int fromIndex, int toIndex, A replacement)
      Parameters:
      fromIndex -
      toIndex -
      replacement -
    • containsAny

      public abstract boolean containsAny(L l)
      Parameters:
      l -
      Returns:
    • containsAny

      public abstract boolean containsAny(A a)
      Parameters:
      a -
      Returns:
    • containsAll

      public abstract boolean containsAll(L l)
      Parameters:
      l -
      Returns:
    • containsAll

      public abstract boolean containsAll(A a)
      Parameters:
      a -
      Returns:
    • disjoint

      public abstract boolean disjoint(L l)
      Parameters:
      l -
      Returns:
    • disjoint

      public abstract boolean disjoint(A a)
      Parameters:
      a -
      Returns:
    • hasDuplicates

      public abstract boolean hasDuplicates()
      Returns:
    • intersection

      public abstract L intersection(L b)
      Parameters:
      b -
      Returns:
    • intersection

      public abstract L intersection(A a)
      Parameters:
      a -
      Returns:
    • difference

      public abstract L difference(L b)
      Parameters:
      b -
      Returns:
    • difference

      public abstract L difference(A a)
      Parameters:
      a -
      Returns:
    • symmetricDifference

      public abstract L symmetricDifference(L b)
      Parameters:
      b -
      Returns:
    • symmetricDifference

      public abstract L symmetricDifference(A a)
      Parameters:
      a -
      Returns:
    • distinct

      public L distinct()
      Returns:
      a new List with distinct elements
    • distinct

      public abstract L distinct(int fromIndex, int toIndex)
      Parameters:
      fromIndex -
      toIndex -
      Returns:
      a new List with distinct elements
    • isSorted

      public abstract boolean isSorted()
      Returns:
    • sort

      public abstract void sort()
    • reverseSort

      public abstract void reverseSort()
    • reverse

      public abstract void reverse()
    • reverse

      public abstract void reverse(int fromIndex, int toIndex)
      Parameters:
      fromIndex -
      toIndex -
    • rotate

      public abstract void rotate(int distance)
      Parameters:
      distance -
    • shuffle

      public abstract void shuffle()
    • shuffle

      public abstract void shuffle(Random rnd)
      Parameters:
      rnd -
    • swap

      public abstract void swap(int i, int j)
      Parameters:
      i -
      j -
    • copy

      public abstract L copy()
      Returns:
      a copy of this List
    • copy

      public abstract L copy(int fromIndex, int toIndex)
      Parameters:
      fromIndex -
      toIndex -
      Returns:
    • copy

      public abstract L copy(int fromIndex, int toIndex, int step)
      Parameters:
      fromIndex -
      toIndex -
      step -
      Returns:
    • split

      public List<L> split(int chunkSize)
      Returns consecutive sub lists of this list, each of the same size (the final list may be smaller), or an empty List if the specified list is null or empty.
      Parameters:
      chunkSize - the desired size of each sub sequence (the last may be smaller).
      Returns:
    • split

      public abstract List<L> split(int fromIndex, int toIndex, int chunkSize)
      Returns List of PrimitiveList 'L' with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).
      Parameters:
      fromIndex -
      toIndex -
      chunkSize - the desired size of each sub sequence (the last may be smaller).
      Returns:
    • join

      public String join()
      Returns:
    • join

      public String join(char delimiter)
      Parameters:
      delimiter -
      Returns:
    • join

      public String join(String delimiter)
      Parameters:
      delimiter -
      Returns:
    • join

      public String join(int fromIndex, int toIndex)
      Parameters:
      fromIndex -
      toIndex -
      Returns:
    • join

      public abstract String join(int fromIndex, int toIndex, char delimiter)
      Parameters:
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • join

      public abstract String join(int fromIndex, int toIndex, String delimiter)
      Parameters:
      fromIndex -
      toIndex -
      delimiter -
      Returns:
    • trimToSize

      @Beta public abstract L trimToSize()
      Trim to size and return {@code this) list. There is no new list instance created. @return this List with trailing unused space removed.
    • clear

      public abstract void clear()
      Clear.
    • isEmpty

      public abstract boolean isEmpty()
      Checks if is empty.
      Returns:
      true, if is empty
    • size

      public abstract int size()
      Returns:
    • toArray

      public abstract A toArray()
      Returns:
    • toList

      public List<B> toList()
      Returns:
    • toList

      public List<B> toList(int fromIndex, int toIndex)
      Parameters:
      fromIndex -
      toIndex -
      Returns:
    • toSet

      public Set<B> toSet()
      Returns:
    • toSet

      public Set<B> toSet(int fromIndex, int toIndex)
      Parameters:
      fromIndex -
      toIndex -
      Returns:
    • toCollection

      public <C extends Collection<B>> C toCollection(IntFunction<? extends C> supplier)
      Type Parameters:
      C -
      Parameters:
      supplier -
      Returns:
    • toCollection

      public abstract <C extends Collection<B>> C toCollection(int fromIndex, int toIndex, IntFunction<? extends C> supplier)
      Type Parameters:
      C -
      Parameters:
      fromIndex -
      toIndex -
      supplier -
      Returns:
    • toMultiset

      public Multiset<B> toMultiset()
      Returns:
    • toMultiset

      public Multiset<B> toMultiset(int fromIndex, int toIndex)
      Parameters:
      fromIndex -
      toIndex -
      Returns:
    • toMultiset

      public Multiset<B> toMultiset(IntFunction<Multiset<B>> supplier)
      Parameters:
      supplier -
      Returns:
    • toMultiset

      public abstract Multiset<B> toMultiset(int fromIndex, int toIndex, IntFunction<Multiset<B>> supplier)
      Parameters:
      fromIndex -
      toIndex -
      supplier -
      Returns:
    • apply

      public abstract <R, E extends Exception> R apply(Throwables.Function<? super L,? extends R,E> func) throws E
      Type Parameters:
      R -
      E -
      Parameters:
      func -
      Returns:
      Throws:
      E - the e
    • applyIfNotEmpty

      public abstract <R, E extends Exception> u.Optional<R> applyIfNotEmpty(Throwables.Function<? super L,? extends R,E> func) throws E
      Apply if not empty.
      Type Parameters:
      R -
      E -
      Parameters:
      func -
      Returns:
      Throws:
      E - the e
    • accept

      public abstract <E extends Exception> void accept(Throwables.Consumer<? super L,E> action) throws E
      Type Parameters:
      E -
      Parameters:
      action -
      Throws:
      E - the e
    • acceptIfNotEmpty

      public abstract <E extends Exception> If.OrElse acceptIfNotEmpty(Throwables.Consumer<? super L,E> action) throws E
      Accept if not empty.
      Type Parameters:
      E -
      Parameters:
      action -
      Returns:
      Throws:
      E - the e
    • println

      public void println()