Package com.landawn.abacus.util
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract <E extends Exception>
voidaccept
(Throwables.Consumer<? super L, E> action) acceptIfNotEmpty
(Throwables.Consumer<? super L, E> action) Accept if not empty.abstract boolean
abstract boolean
abstract boolean
abstract boolean
abstract <R,
E extends Exception>
Rapply
(Throwables.Function<? super L, ? extends R, E> func) abstract <R,
E extends Exception>
u.Optional<R>applyIfNotEmpty
(Throwables.Function<? super L, ? extends R, E> func) Apply if not empty.abstract A
array()
Deprecated.abstract void
clear()
Clear.abstract boolean
containsAll
(A a) abstract boolean
containsAll
(L l) abstract boolean
containsAny
(A a) abstract boolean
containsAny
(L l) abstract L
copy()
abstract L
copy
(int fromIndex, int toIndex) abstract L
copy
(int fromIndex, int toIndex, int step) abstract void
deleteAllByIndices
(int... indices) abstract void
deleteRange
(int fromIndex, int toIndex) abstract L
difference
(A a) abstract L
difference
(L b) abstract boolean
abstract boolean
distinct()
abstract L
distinct
(int fromIndex, int toIndex) abstract boolean
abstract L
intersection
(A a) abstract L
intersection
(L b) abstract boolean
isEmpty()
Checks if is empty.abstract boolean
isSorted()
join()
join
(char delimiter) join
(int fromIndex, int toIndex) abstract String
join
(int fromIndex, int toIndex, char delimiter) abstract String
abstract void
moveRange
(int fromIndex, int toIndex, int newPositionStartIndex) void
println()
abstract boolean
abstract boolean
abstract boolean
abstract void
replaceRange
(int fromIndex, int toIndex, A replacement) abstract boolean
abstract boolean
abstract void
reverse()
abstract void
reverse
(int fromIndex, int toIndex) abstract void
abstract void
rotate
(int distance) abstract void
shuffle()
abstract void
abstract int
size()
abstract void
sort()
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.split
(int fromIndex, int toIndex, int chunkSize) Returns List ofPrimitiveList 'L'
with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).abstract void
swap
(int i, int j) abstract L
abstract L
abstract A
toArray()
abstract <C extends Collection<B>>
CtoCollection
(int fromIndex, int toIndex, IntFunction<? extends C> supplier) <C extends Collection<B>>
CtoCollection
(IntFunction<? extends C> supplier) toList()
toList
(int fromIndex, int toIndex) toMultiset
(int fromIndex, int toIndex) toMultiset
(int fromIndex, int toIndex, IntFunction<Multiset<B>> supplier) toMultiset
(IntFunction<Multiset<B>> supplier) toSet()
toSet
(int fromIndex, int toIndex) abstract L
Trim to size and returnthis
list.
-
Constructor Details
-
PrimitiveList
public PrimitiveList()
-
-
Method Details
-
array
Deprecated.should calltoArray()
Returned the backed array.- Returns:
-
addAll
- Parameters:
c
-- Returns:
-
addAll
- Parameters:
index
-c
-- Returns:
-
addAll
- Parameters:
a
-- Returns:
-
addAll
- Parameters:
index
-a
-- Returns:
-
removeAll
- Parameters:
c
-- Returns:
-
removeAll
- Parameters:
a
-- Returns:
-
removeDuplicates
public abstract boolean removeDuplicates()- Returns:
-
retainAll
- Parameters:
c
-- Returns:
-
retainAll
- Parameters:
a
-- Returns:
-
deleteAllByIndices
public abstract void deleteAllByIndices(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
- Parameters:
fromIndex
-toIndex
-replacement
-
-
containsAny
- Parameters:
l
-- Returns:
-
containsAny
- Parameters:
a
-- Returns:
-
containsAll
- Parameters:
l
-- Returns:
-
containsAll
- Parameters:
a
-- Returns:
-
disjoint
- Parameters:
l
-- Returns:
-
disjoint
- Parameters:
a
-- Returns:
-
hasDuplicates
public abstract boolean hasDuplicates()- Returns:
-
intersection
- Parameters:
b
-- Returns:
-
intersection
- Parameters:
a
-- Returns:
-
difference
- Parameters:
b
-- Returns:
-
difference
- Parameters:
a
-- Returns:
-
symmetricDifference
- Parameters:
b
-- Returns:
-
symmetricDifference
- Parameters:
a
-- Returns:
-
distinct
- Returns:
- a new List with distinct elements
-
distinct
- 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
- Parameters:
rnd
-
-
swap
public abstract void swap(int i, int j) - Parameters:
i
-j
-
-
copy
- Returns:
- a copy of this List
-
copy
- Parameters:
fromIndex
-toIndex
-- Returns:
-
copy
- Parameters:
fromIndex
-toIndex
-step
-- Returns:
-
split
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
Returns List ofPrimitiveList '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
- Returns:
-
join
- Parameters:
delimiter
-- Returns:
-
join
- Parameters:
delimiter
-- Returns:
-
join
- Parameters:
fromIndex
-toIndex
-- Returns:
-
join
- Parameters:
fromIndex
-toIndex
-delimiter
-- Returns:
-
join
- Parameters:
fromIndex
-toIndex
-delimiter
-- Returns:
-
trimToSize
Trim to size and returnthis
list. There is no new list instance created.- Returns:
- 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
- Returns:
-
toList
- Returns:
-
toList
- Parameters:
fromIndex
-toIndex
-- Returns:
-
toSet
- Returns:
-
toSet
- Parameters:
fromIndex
-toIndex
-- Returns:
-
toCollection
- 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
- Returns:
-
toMultiset
- Parameters:
fromIndex
-toIndex
-- Returns:
-
toMultiset
- 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, throws EE> func) - 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, throws EE> func) Apply if not empty.- Type Parameters:
R
-E
-- Parameters:
func
-- Returns:
- Throws:
E
- the e
-
accept
- 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 EAccept if not empty.- Type Parameters:
E
-- Parameters:
action
-- Returns:
- Throws:
E
- the e
-
println
public void println()
-
toArray()