Package com.landawn.abacus.util
Class ByteList
- java.lang.Object
-
- com.landawn.abacus.util.PrimitiveList<Byte,byte[],ByteList>
-
- com.landawn.abacus.util.ByteList
-
- All Implemented Interfaces:
Serializable
,RandomAccess
public final class ByteList extends PrimitiveList<Byte,byte[],ByteList>
The Class ByteList.- Since:
- 0.8
- Author:
- Haiyang Li
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ByteList()
Instantiates a new byte list.ByteList(byte[] a)
The specified array is used as the element array for this list without copying action.ByteList(byte[] a, int size)
Instantiates a new byte list.ByteList(int initialCapacity)
Instantiates a new byte list.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <E extends Exception>
voidaccept(Throwables.Consumer<? super ByteList,E> action)
<E extends Exception>
If.OrElseacceptIfNotEmpty(Throwables.Consumer<? super ByteList,E> action)
Accept if not empty.void
add(byte e)
void
add(int index, byte e)
boolean
addAll(byte[] a)
Adds the all.boolean
addAll(int index, byte[] a)
Adds the all.boolean
addAll(int index, ByteList c)
Adds the all.boolean
addAll(ByteList c)
Adds the all.<E extends Exception>
booleanallMatch(int fromIndex, int toIndex, Throwables.BytePredicate<E> filter)
<E extends Exception>
booleanallMatch(Throwables.BytePredicate<E> filter)
Returns whether all elements of this List match the provided predicate.<E extends Exception>
booleananyMatch(int fromIndex, int toIndex, Throwables.BytePredicate<E> filter)
<E extends Exception>
booleananyMatch(Throwables.BytePredicate<E> filter)
Returns whether any elements of this List match the provided predicate.<R,E extends Exception>
Rapply(Throwables.Function<? super ByteList,R,E> func)
<R,E extends Exception>
u.Optional<R>applyIfNotEmpty(Throwables.Function<? super ByteList,R,E> func)
Apply if not empty.byte[]
array()
Returns the original element array without copying.u.OptionalDouble
average()
u.OptionalDouble
average(int fromIndex, int toIndex)
int
binarySearch(byte key)
This List should be sorted first.int
binarySearch(int fromIndex, int toIndex, byte key)
This List should be sorted first.List<Byte>
boxed()
List<Byte>
boxed(int fromIndex, int toIndex)
void
clear()
Clear.boolean
contains(byte e)
boolean
containsAll(byte[] a)
boolean
containsAll(ByteList c)
boolean
containsAny(byte[] a)
boolean
containsAny(ByteList c)
ByteList
copy()
ByteList
copy(int fromIndex, int toIndex)
ByteList
copy(int from, int to, int step)
static ByteList
copyOf(byte[] a)
static ByteList
copyOf(byte[] a, int fromIndex, int toIndex)
<E extends Exception>
intcount(int fromIndex, int toIndex, Throwables.BytePredicate<E> filter)
<E extends Exception>
intcount(Throwables.BytePredicate<E> filter)
byte
delete(int index)
void
deleteAll(int... indices)
void
deleteRange(int fromIndex, int toIndex)
ByteList
difference(byte[] a)
ByteList
difference(ByteList b)
boolean
disjoint(byte[] b)
boolean
disjoint(ByteList c)
ByteList
distinct(int fromIndex, int toIndex)
boolean
equals(Object obj)
void
fill(byte val)
void
fill(int fromIndex, int toIndex, byte val)
<E extends Exception>
ByteListfilter(int fromIndex, int toIndex, Throwables.BytePredicate<E> filter)
<E extends Exception>
ByteListfilter(int fromIndex, int toIndex, Throwables.BytePredicate<E> filter, int max)
<E extends Exception>
ByteListfilter(Throwables.BytePredicate<E> filter)
<E extends Exception>
ByteListfilter(Throwables.BytePredicate<E> filter, int max)
<E extends Exception>
u.OptionalBytefindFirst(Throwables.BytePredicate<E> predicate)
<E extends Exception>
u.OptionalIntfindFirstIndex(Throwables.BytePredicate<E> predicate)
Find first index.<E extends Exception>
u.OptionalBytefindLast(Throwables.BytePredicate<E> predicate)
<E extends Exception>
u.OptionalIntfindLastIndex(Throwables.BytePredicate<E> predicate)
Find last index.u.OptionalByte
first()
<E extends Exception>
voidforEach(int fromIndex, int toIndex, Throwables.ByteConsumer<E> action)
<E extends Exception>
voidforEach(Throwables.ByteConsumer<E> action)
<E extends Exception>
voidforEachIndexed(int fromIndex, int toIndex, Throwables.IndexedByteConsumer<E> action)
<E extends Exception>
voidforEachIndexed(Throwables.IndexedByteConsumer<E> action)
static ByteList
from(Collection<Byte> c)
static ByteList
from(Collection<Byte> c, byte defaultForNull)
static ByteList
from(Collection<Byte> c, int fromIndex, int toIndex)
static ByteList
from(Collection<Byte> c, int fromIndex, int toIndex, byte defaultForNull)
byte
get(int index)
boolean
hasDuplicates()
Checks for duplicates.int
hashCode()
int
indexOf(byte e)
int
indexOf(int fromIndex, byte e)
ByteList
intersection(byte[] a)
ByteList
intersection(ByteList b)
boolean
isEmpty()
Checks if is empty.ByteIterator
iterator()
String
join(int fromIndex, int toIndex, char delimiter)
String
join(int fromIndex, int toIndex, String delimiter)
u.OptionalByte
kthLargest(int k)
u.OptionalByte
kthLargest(int fromIndex, int toIndex, int k)
u.OptionalByte
last()
int
lastIndexOf(byte e)
Last index of.int
lastIndexOf(int fromIndex, byte e)
Last index of.<E extends Exception>
ByteListmap(int fromIndex, int toIndex, Throwables.ByteUnaryOperator<E> mapper)
<E extends Exception>
ByteListmap(Throwables.ByteUnaryOperator<E> mapper)
<T,E extends Exception>
List<T>mapToObj(int fromIndex, int toIndex, Throwables.ByteFunction<? extends T,E> mapper)
Map to obj.<T,E extends Exception>
List<T>mapToObj(Throwables.ByteFunction<? extends T,E> mapper)
Map to obj.u.OptionalByte
max()
u.OptionalByte
max(int fromIndex, int toIndex)
u.OptionalByte
median()
u.OptionalByte
median(int fromIndex, int toIndex)
u.OptionalByte
min()
u.OptionalByte
min(int fromIndex, int toIndex)
<E extends Exception>
booleannoneMatch(int fromIndex, int toIndex, Throwables.BytePredicate<E> filter)
<E extends Exception>
booleannoneMatch(Throwables.BytePredicate<E> filter)
Returns whether no elements of this List match the provided predicate.int
occurrencesOf(byte objectToFind)
static ByteList
of(byte... a)
static ByteList
of(byte[] a, int size)
void
parallelSort()
Parallel sort.static ByteList
random(int len)
static ByteList
range(byte startInclusive, byte endExclusive)
static ByteList
range(byte startInclusive, byte endExclusive, byte by)
static ByteList
rangeClosed(byte startInclusive, byte endInclusive)
static ByteList
rangeClosed(byte startInclusive, byte endInclusive, byte by)
<E extends Exception>
bytereduce(byte identity, Throwables.ByteBinaryOperator<E> accumulator)
This is equivalent to:<E extends Exception>
u.OptionalBytereduce(Throwables.ByteBinaryOperator<E> accumulator)
This is equivalent to:boolean
remove(byte e)
boolean
removeAll(byte[] a)
Removes the all.boolean
removeAll(ByteList c)
Removes the all.boolean
removeAllOccurrences(byte e)
Removes the all occurrences.<E extends Exception>
booleanremoveIf(Throwables.BytePredicate<E> p)
Removes the if.static ByteList
repeat(byte element, int len)
int
replaceAll(byte oldVal, byte newVal)
<E extends Exception>
voidreplaceAll(Throwables.ByteUnaryOperator<E> operator)
<E extends Exception>
booleanreplaceIf(Throwables.BytePredicate<E> predicate, byte newValue)
boolean
retainAll(byte[] a)
boolean
retainAll(ByteList c)
void
reverse()
Reverse.void
reverse(int fromIndex, int toIndex)
void
reverseSort()
Reverse sort.void
rotate(int distance)
byte
set(int index, byte e)
void
shuffle()
Shuffle.void
shuffle(Random rnd)
int
size()
void
sort()
Sort.List<ByteList>
split(int fromIndex, int toIndex, int chunkSize)
Returns List ofByteList
with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).ByteStream
stream()
ByteStream
stream(int fromIndex, int toIndex)
int
sum()
int
sum(int fromIndex, int toIndex)
void
swap(int i, int j)
ByteList
symmetricDifference(byte[] a)
ByteList
symmetricDifference(ByteList b)
byte[]
toArray()
<C extends Collection<Byte>>
CtoCollection(int fromIndex, int toIndex, IntFunction<? extends C> supplier)
IntList
toIntList()
To int list.<K,A,D,E extends Exception>
Map<K,D>toMap(Throwables.ByteFunction<? extends K,E> keyMapper, Collector<Byte,A,D> downstream)
<K,A,D,M extends Map<K,D>,E extends Exception>
MtoMap(Throwables.ByteFunction<? extends K,E> keyMapper, Collector<Byte,A,D> downstream, IntFunction<? extends M> mapFactory)
<K,V,E extends Exception,E2 extends Exception>
Map<K,V>toMap(Throwables.ByteFunction<? extends K,E> keyMapper, Throwables.ByteFunction<? extends V,E2> valueMapper)
<K,V,M extends Map<K,V>,E extends Exception,E2 extends Exception>
MtoMap(Throwables.ByteFunction<? extends K,E> keyMapper, Throwables.ByteFunction<? extends V,E2> valueMapper, IntFunction<? extends M> mapFactory)
<K,V,E extends Exception,E2 extends Exception,E3 extends Exception>
Map<K,V>toMap(Throwables.ByteFunction<? extends K,E> keyMapper, Throwables.ByteFunction<? extends V,E2> valueMapper, Throwables.BinaryOperator<V,E3> mergeFunction)
<K,V,M extends Map<K,V>,E extends Exception,E2 extends Exception,E3 extends Exception>
MtoMap(Throwables.ByteFunction<? extends K,E> keyMapper, Throwables.ByteFunction<? extends V,E2> valueMapper, Throwables.BinaryOperator<V,E3> mergeFunction, IntFunction<? extends M> mapFactory)
Multiset<Byte>
toMultiset(int fromIndex, int toIndex, IntFunction<Multiset<Byte>> supplier)
String
toString()
ByteList
trimToSize()
Trim to size.-
Methods inherited from class com.landawn.abacus.util.PrimitiveList
distinct, join, join, join, join, println, split, toCollection, toList, toList, toMultiset, toMultiset, toMultiset, toSet, toSet
-
-
-
-
Constructor Detail
-
ByteList
public ByteList()
Instantiates a new byte list.
-
ByteList
public ByteList(int initialCapacity)
Instantiates a new byte list.- Parameters:
initialCapacity
-
-
ByteList
public ByteList(byte[] a)
The specified array is used as the element array for this list without copying action.- Parameters:
a
-
-
ByteList
public ByteList(byte[] a, int size)
Instantiates a new byte list.- Parameters:
a
-size
-
-
-
Method Detail
-
of
@SafeVarargs public static ByteList of(byte... a)
- Parameters:
a
-- Returns:
-
of
public static ByteList of(byte[] a, int size)
- Parameters:
a
-size
-- Returns:
-
copyOf
public static ByteList copyOf(byte[] a)
- Parameters:
a
-- Returns:
-
copyOf
public static ByteList copyOf(byte[] a, int fromIndex, int toIndex)
- Parameters:
a
-fromIndex
-toIndex
-- Returns:
-
from
public static ByteList from(Collection<Byte> c)
- Parameters:
c
-- Returns:
-
from
public static ByteList from(Collection<Byte> c, byte defaultForNull)
- Parameters:
c
-defaultForNull
-- Returns:
-
from
public static ByteList from(Collection<Byte> c, int fromIndex, int toIndex)
- Parameters:
c
-fromIndex
-toIndex
-- Returns:
-
from
public static ByteList from(Collection<Byte> c, int fromIndex, int toIndex, byte defaultForNull)
- Parameters:
c
-fromIndex
-toIndex
-defaultForNull
-- Returns:
-
range
public static ByteList range(byte startInclusive, byte endExclusive)
- Parameters:
startInclusive
-endExclusive
-- Returns:
-
range
public static ByteList range(byte startInclusive, byte endExclusive, byte by)
- Parameters:
startInclusive
-endExclusive
-by
-- Returns:
-
rangeClosed
public static ByteList rangeClosed(byte startInclusive, byte endInclusive)
- Parameters:
startInclusive
-endInclusive
-- Returns:
-
rangeClosed
public static ByteList rangeClosed(byte startInclusive, byte endInclusive, byte by)
- Parameters:
startInclusive
-endInclusive
-by
-- Returns:
-
repeat
public static ByteList repeat(byte element, int len)
- Parameters:
element
-len
-- Returns:
-
random
public static ByteList random(int len)
- Parameters:
len
-- Returns:
-
array
public byte[] array()
Returns the original element array without copying.- Specified by:
array
in classPrimitiveList<Byte,byte[],ByteList>
- Returns:
-
get
public byte get(int index)
- Parameters:
index
-- Returns:
-
set
public byte set(int index, byte e)
- Parameters:
index
-e
-- Returns:
-
add
public void add(byte e)
- Parameters:
e
-
-
add
public void add(int index, byte e)
- Parameters:
index
-e
-
-
addAll
public boolean addAll(ByteList c)
Adds the all.- Parameters:
c
-- Returns:
- true, if successful
-
addAll
public boolean addAll(int index, ByteList c)
Adds the all.- Parameters:
index
-c
-- Returns:
- true, if successful
-
addAll
public boolean addAll(byte[] a)
Adds the all.- Specified by:
addAll
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
a
-- Returns:
- true, if successful
-
addAll
public boolean addAll(int index, byte[] a)
Adds the all.- Specified by:
addAll
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
index
-a
-- Returns:
- true, if successful
-
remove
public boolean remove(byte e)
- Parameters:
e
-- Returns:
- true if this list contained the specified element
-
removeAllOccurrences
public boolean removeAllOccurrences(byte e)
Removes the all occurrences.- Parameters:
e
-- Returns:
- true if this list contained the specified element
-
removeAll
public boolean removeAll(ByteList c)
Removes the all.- Parameters:
c
-- Returns:
- true, if successful
-
removeAll
public boolean removeAll(byte[] a)
Removes the all.- Specified by:
removeAll
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
a
-- Returns:
- true, if successful
-
removeIf
public <E extends Exception> boolean removeIf(Throwables.BytePredicate<E> p) throws E extends Exception
Removes the if.- Type Parameters:
E
-- Parameters:
p
-- Returns:
- true, if successful
- Throws:
E
- the eE extends Exception
-
retainAll
public boolean retainAll(ByteList c)
- Parameters:
c
-- Returns:
- true, if successful
-
retainAll
public boolean retainAll(byte[] a)
- Parameters:
a
-- Returns:
- true, if successful
-
delete
public byte delete(int index)
- Parameters:
index
-- Returns:
-
deleteAll
@SafeVarargs public final void deleteAll(int... indices)
- Specified by:
deleteAll
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
indices
-
-
deleteRange
public void deleteRange(int fromIndex, int toIndex)
- Specified by:
deleteRange
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
fromIndex
-toIndex
-
-
replaceAll
public int replaceAll(byte oldVal, byte newVal)
- Parameters:
oldVal
-newVal
-- Returns:
-
replaceAll
public <E extends Exception> void replaceAll(Throwables.ByteUnaryOperator<E> operator) throws E extends Exception
- Type Parameters:
E
-- Parameters:
operator
-- Throws:
E
- the eE extends Exception
-
replaceIf
public <E extends Exception> boolean replaceIf(Throwables.BytePredicate<E> predicate, byte newValue) throws E extends Exception
- Type Parameters:
E
-- Parameters:
predicate
-newValue
-- Returns:
- true, if successful
- Throws:
E
- the eE extends Exception
-
fill
public void fill(byte val)
- Parameters:
val
-
-
fill
public void fill(int fromIndex, int toIndex, byte val)
- Parameters:
fromIndex
-toIndex
-val
-
-
contains
public boolean contains(byte e)
- Parameters:
e
-- Returns:
- true, if successful
-
containsAll
public boolean containsAll(ByteList c)
- Parameters:
c
-- Returns:
- true, if successful
-
containsAll
public boolean containsAll(byte[] a)
- Specified by:
containsAll
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
a
-- Returns:
- true, if successful
-
containsAny
public boolean containsAny(ByteList c)
- Parameters:
c
-- Returns:
- true, if successful
-
containsAny
public boolean containsAny(byte[] a)
- Specified by:
containsAny
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
a
-- Returns:
- true, if successful
-
disjoint
public boolean disjoint(ByteList c)
- Parameters:
c
-- Returns:
- true, if successful
-
disjoint
public boolean disjoint(byte[] b)
- Specified by:
disjoint
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
b
-- Returns:
- true, if successful
-
intersection
public ByteList intersection(ByteList b)
- Parameters:
b
-- Returns:
- See Also:
IntList.intersection(IntList)
-
intersection
public ByteList intersection(byte[] a)
- Parameters:
a
-- Returns:
-
difference
public ByteList difference(ByteList b)
- Parameters:
b
-- Returns:
- See Also:
IntList.difference(IntList)
-
difference
public ByteList difference(byte[] a)
- Parameters:
a
-- Returns:
-
symmetricDifference
public ByteList symmetricDifference(ByteList b)
- Parameters:
b
-- Returns:
- this.difference(b).addAll(b.difference(this))
- See Also:
IntList.symmetricDifference(IntList)
-
symmetricDifference
public ByteList symmetricDifference(byte[] a)
- Parameters:
a
-- Returns:
-
occurrencesOf
public int occurrencesOf(byte objectToFind)
- Parameters:
objectToFind
-- Returns:
-
indexOf
public int indexOf(byte e)
- Parameters:
e
-- Returns:
-
indexOf
public int indexOf(int fromIndex, byte e)
- Parameters:
fromIndex
-e
-- Returns:
-
lastIndexOf
public int lastIndexOf(byte e)
Last index of.- Parameters:
e
-- Returns:
-
lastIndexOf
public int lastIndexOf(int fromIndex, byte e)
Last index of.- Parameters:
fromIndex
- the start index to traverse backwards from. Inclusive.e
-- Returns:
-
min
public u.OptionalByte min()
- Returns:
-
min
public u.OptionalByte min(int fromIndex, int toIndex)
- Parameters:
fromIndex
-toIndex
-- Returns:
-
median
public u.OptionalByte median()
- Returns:
-
median
public u.OptionalByte median(int fromIndex, int toIndex)
- Parameters:
fromIndex
-toIndex
-- Returns:
-
max
public u.OptionalByte max()
- Returns:
-
max
public u.OptionalByte max(int fromIndex, int toIndex)
- Parameters:
fromIndex
-toIndex
-- Returns:
-
kthLargest
public u.OptionalByte kthLargest(int k)
- Parameters:
k
-- Returns:
-
kthLargest
public u.OptionalByte kthLargest(int fromIndex, int toIndex, int k)
- Parameters:
fromIndex
-toIndex
-k
-- Returns:
-
sum
public int sum()
- Returns:
-
sum
public int sum(int fromIndex, int toIndex)
- Parameters:
fromIndex
-toIndex
-- Returns:
-
average
public u.OptionalDouble average()
- Returns:
-
average
public u.OptionalDouble average(int fromIndex, int toIndex)
- Parameters:
fromIndex
-toIndex
-- Returns:
-
forEach
public <E extends Exception> void forEach(Throwables.ByteConsumer<E> action) throws E extends Exception
- Type Parameters:
E
-- Parameters:
action
-- Throws:
E
- the eE extends Exception
-
forEach
public <E extends Exception> void forEach(int fromIndex, int toIndex, Throwables.ByteConsumer<E> action) throws E extends Exception
- Type Parameters:
E
-- Parameters:
fromIndex
-toIndex
-action
-- Throws:
E
- the eE extends Exception
-
forEachIndexed
public <E extends Exception> void forEachIndexed(Throwables.IndexedByteConsumer<E> action) throws E extends Exception
- Type Parameters:
E
-- Parameters:
action
-- Throws:
E
- the eE extends Exception
-
forEachIndexed
public <E extends Exception> void forEachIndexed(int fromIndex, int toIndex, Throwables.IndexedByteConsumer<E> action) throws E extends Exception
- Type Parameters:
E
-- Parameters:
fromIndex
-toIndex
-action
-- Throws:
E
- the eE extends Exception
-
first
public u.OptionalByte first()
- Returns:
-
last
public u.OptionalByte last()
- Returns:
-
findFirst
public <E extends Exception> u.OptionalByte findFirst(Throwables.BytePredicate<E> predicate) throws E extends Exception
- Type Parameters:
E
-- Parameters:
predicate
-- Returns:
- Throws:
E
- the eE extends Exception
-
findLast
public <E extends Exception> u.OptionalByte findLast(Throwables.BytePredicate<E> predicate) throws E extends Exception
- Type Parameters:
E
-- Parameters:
predicate
-- Returns:
- Throws:
E
- the eE extends Exception
-
findFirstIndex
public <E extends Exception> u.OptionalInt findFirstIndex(Throwables.BytePredicate<E> predicate) throws E extends Exception
Find first index.- Type Parameters:
E
-- Parameters:
predicate
-- Returns:
- Throws:
E
- the eE extends Exception
-
findLastIndex
public <E extends Exception> u.OptionalInt findLastIndex(Throwables.BytePredicate<E> predicate) throws E extends Exception
Find last index.- Type Parameters:
E
-- Parameters:
predicate
-- Returns:
- Throws:
E
- the eE extends Exception
-
allMatch
public <E extends Exception> boolean allMatch(Throwables.BytePredicate<E> filter) throws E extends Exception
Returns whether all elements of this List match the provided predicate.- Type Parameters:
E
-- Parameters:
filter
-- Returns:
- true, if successful
- Throws:
E
- the eE extends Exception
-
allMatch
public <E extends Exception> boolean allMatch(int fromIndex, int toIndex, Throwables.BytePredicate<E> filter) throws E extends Exception
- Type Parameters:
E
-- Parameters:
fromIndex
-toIndex
-filter
-- Returns:
- true, if successful
- Throws:
E
- the eE extends Exception
-
anyMatch
public <E extends Exception> boolean anyMatch(Throwables.BytePredicate<E> filter) throws E extends Exception
Returns whether any elements of this List match the provided predicate.- Type Parameters:
E
-- Parameters:
filter
-- Returns:
- true, if successful
- Throws:
E
- the eE extends Exception
-
anyMatch
public <E extends Exception> boolean anyMatch(int fromIndex, int toIndex, Throwables.BytePredicate<E> filter) throws E extends Exception
- Type Parameters:
E
-- Parameters:
fromIndex
-toIndex
-filter
-- Returns:
- true, if successful
- Throws:
E
- the eE extends Exception
-
noneMatch
public <E extends Exception> boolean noneMatch(Throwables.BytePredicate<E> filter) throws E extends Exception
Returns whether no elements of this List match the provided predicate.- Type Parameters:
E
-- Parameters:
filter
-- Returns:
- true, if successful
- Throws:
E
- the eE extends Exception
-
noneMatch
public <E extends Exception> boolean noneMatch(int fromIndex, int toIndex, Throwables.BytePredicate<E> filter) throws E extends Exception
- Type Parameters:
E
-- Parameters:
fromIndex
-toIndex
-filter
-- Returns:
- true, if successful
- Throws:
E
- the eE extends Exception
-
count
public <E extends Exception> int count(Throwables.BytePredicate<E> filter) throws E extends Exception
- Type Parameters:
E
-- Parameters:
filter
-- Returns:
- Throws:
E
- the eE extends Exception
-
count
public <E extends Exception> int count(int fromIndex, int toIndex, Throwables.BytePredicate<E> filter) throws E extends Exception
- Type Parameters:
E
-- Parameters:
fromIndex
-toIndex
-filter
-- Returns:
- Throws:
E
- the eE extends Exception
-
filter
public <E extends Exception> ByteList filter(Throwables.BytePredicate<E> filter) throws E extends Exception
- Type Parameters:
E
-- Parameters:
filter
-- Returns:
- a new List with the elements match the provided predicate.
- Throws:
E
- the eE extends Exception
-
filter
public <E extends Exception> ByteList filter(int fromIndex, int toIndex, Throwables.BytePredicate<E> filter) throws E extends Exception
- Type Parameters:
E
-- Parameters:
fromIndex
-toIndex
-filter
-- Returns:
- Throws:
E
- the eE extends Exception
-
filter
public <E extends Exception> ByteList filter(Throwables.BytePredicate<E> filter, int max) throws E extends Exception
- Type Parameters:
E
-- Parameters:
filter
-max
-- Returns:
- a new List with the elements match the provided predicate.
- Throws:
E
- the eE extends Exception
-
filter
public <E extends Exception> ByteList filter(int fromIndex, int toIndex, Throwables.BytePredicate<E> filter, int max) throws E extends Exception
- Type Parameters:
E
-- Parameters:
fromIndex
-toIndex
-filter
-max
-- Returns:
- Throws:
E
- the eE extends Exception
-
map
public <E extends Exception> ByteList map(Throwables.ByteUnaryOperator<E> mapper) throws E extends Exception
- Type Parameters:
E
-- Parameters:
mapper
-- Returns:
- Throws:
E
- the eE extends Exception
-
map
public <E extends Exception> ByteList map(int fromIndex, int toIndex, Throwables.ByteUnaryOperator<E> mapper) throws E extends Exception
- Type Parameters:
E
-- Parameters:
fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
E
- the eE extends Exception
-
mapToObj
public <T,E extends Exception> List<T> mapToObj(Throwables.ByteFunction<? extends T,E> mapper) throws E extends Exception
Map to obj.- Type Parameters:
T
-E
-- Parameters:
mapper
-- Returns:
- Throws:
E
- the eE extends Exception
-
mapToObj
public <T,E extends Exception> List<T> mapToObj(int fromIndex, int toIndex, Throwables.ByteFunction<? extends T,E> mapper) throws E extends Exception
Map to obj.- Type Parameters:
T
-E
-- Parameters:
fromIndex
-toIndex
-mapper
-- Returns:
- Throws:
E
- the eE extends Exception
-
reduce
public <E extends Exception> u.OptionalByte reduce(Throwables.ByteBinaryOperator<E> accumulator) throws E extends Exception
This is equivalent to:if (isEmpty()) { return OptionalByte.empty(); } byte result = elementData[0]; for (int i = 1; i < size; i++) { result = accumulator.applyAsByte(result, elementData[i]); } return OptionalByte.of(result);
- Type Parameters:
E
-- Parameters:
accumulator
-- Returns:
- Throws:
E
- the eE extends Exception
-
reduce
public <E extends Exception> byte reduce(byte identity, Throwables.ByteBinaryOperator<E> accumulator) throws E extends Exception
This is equivalent to:if (isEmpty()) { return identity; } byte result = identity; for (int i = 0; i < size; i++) { result = accumulator.applyAsByte(result, elementData[i]); } return result;
- Type Parameters:
E
-- Parameters:
identity
-accumulator
-- Returns:
- Throws:
E
- the eE extends Exception
-
hasDuplicates
public boolean hasDuplicates()
Checks for duplicates.- Specified by:
hasDuplicates
in classPrimitiveList<Byte,byte[],ByteList>
- Returns:
- true, if successful
-
distinct
public ByteList distinct(int fromIndex, int toIndex)
- Specified by:
distinct
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
fromIndex
-toIndex
-- Returns:
-
sort
public void sort()
Sort.- Specified by:
sort
in classPrimitiveList<Byte,byte[],ByteList>
-
parallelSort
public void parallelSort()
Parallel sort.
-
reverseSort
public void reverseSort()
Reverse sort.
-
binarySearch
public int binarySearch(byte key)
This List should be sorted first.- Parameters:
key
-- Returns:
-
binarySearch
public int binarySearch(int fromIndex, int toIndex, byte key)
This List should be sorted first.- Parameters:
fromIndex
-toIndex
-key
-- Returns:
-
reverse
public void reverse()
Reverse.- Specified by:
reverse
in classPrimitiveList<Byte,byte[],ByteList>
-
reverse
public void reverse(int fromIndex, int toIndex)
- Specified by:
reverse
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
fromIndex
-toIndex
-
-
rotate
public void rotate(int distance)
- Specified by:
rotate
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
distance
-
-
shuffle
public void shuffle()
Shuffle.- Specified by:
shuffle
in classPrimitiveList<Byte,byte[],ByteList>
-
shuffle
public void shuffle(Random rnd)
- Specified by:
shuffle
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
rnd
-
-
swap
public void swap(int i, int j)
- Specified by:
swap
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
i
-j
-
-
copy
public ByteList copy()
- Specified by:
copy
in classPrimitiveList<Byte,byte[],ByteList>
- Returns:
-
copy
public ByteList copy(int fromIndex, int toIndex)
- Specified by:
copy
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
fromIndex
-toIndex
-- Returns:
-
copy
public ByteList copy(int from, int to, int step)
- Specified by:
copy
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
from
-to
-step
-- Returns:
- See Also:
CommonUtil.copyOfRange(int[], int, int, int)
-
split
public List<ByteList> split(int fromIndex, int toIndex, int chunkSize)
Returns List ofByteList
with consecutive sub sequences of the elements, each of the same size (the final sequence may be smaller).- Specified by:
split
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
fromIndex
-toIndex
-chunkSize
- the desired size of each sub sequence (the last may be smaller).- Returns:
-
join
public String join(int fromIndex, int toIndex, char delimiter)
- Specified by:
join
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
fromIndex
-toIndex
-delimiter
-- Returns:
-
join
public String join(int fromIndex, int toIndex, String delimiter)
- Specified by:
join
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
fromIndex
-toIndex
-delimiter
-- Returns:
-
trimToSize
public ByteList trimToSize()
Trim to size.- Specified by:
trimToSize
in classPrimitiveList<Byte,byte[],ByteList>
- Returns:
-
clear
public void clear()
Clear.- Specified by:
clear
in classPrimitiveList<Byte,byte[],ByteList>
-
isEmpty
public boolean isEmpty()
Checks if is empty.- Specified by:
isEmpty
in classPrimitiveList<Byte,byte[],ByteList>
- Returns:
- true, if is empty
-
size
public int size()
- Specified by:
size
in classPrimitiveList<Byte,byte[],ByteList>
- Returns:
-
boxed
public List<Byte> boxed(int fromIndex, int toIndex)
- Parameters:
fromIndex
-toIndex
-- Returns:
-
toArray
public byte[] toArray()
- Specified by:
toArray
in classPrimitiveList<Byte,byte[],ByteList>
- Returns:
-
toIntList
public IntList toIntList()
To int list.- Returns:
-
toCollection
public <C extends Collection<Byte>> C toCollection(int fromIndex, int toIndex, IntFunction<? extends C> supplier)
- Specified by:
toCollection
in classPrimitiveList<Byte,byte[],ByteList>
- Type Parameters:
C
-- Parameters:
fromIndex
-toIndex
-supplier
-- Returns:
-
toMultiset
public Multiset<Byte> toMultiset(int fromIndex, int toIndex, IntFunction<Multiset<Byte>> supplier)
- Specified by:
toMultiset
in classPrimitiveList<Byte,byte[],ByteList>
- Parameters:
fromIndex
-toIndex
-supplier
-- Returns:
-
toMap
public <K,V,E extends Exception,E2 extends Exception> Map<K,V> toMap(Throwables.ByteFunction<? extends K,E> keyMapper, Throwables.ByteFunction<? extends V,E2> valueMapper) throws E extends Exception, E2 extends Exception
- Type Parameters:
K
- the key typeV
- the value typeE
-E2
-- Parameters:
keyMapper
-valueMapper
-- Returns:
- Throws:
E
- the eE2
- the e2E extends Exception
-
toMap
public <K,V,M extends Map<K,V>,E extends Exception,E2 extends Exception> M toMap(Throwables.ByteFunction<? extends K,E> keyMapper, Throwables.ByteFunction<? extends V,E2> valueMapper, IntFunction<? extends M> mapFactory) throws E extends Exception, E2 extends Exception
- Type Parameters:
K
- the key typeV
- the value typeM
-E
-E2
-- Parameters:
keyMapper
-valueMapper
-mapFactory
-- Returns:
- Throws:
E
- the eE2
- the e2E extends Exception
-
toMap
public <K,V,E extends Exception,E2 extends Exception,E3 extends Exception> Map<K,V> toMap(Throwables.ByteFunction<? extends K,E> keyMapper, Throwables.ByteFunction<? extends V,E2> valueMapper, Throwables.BinaryOperator<V,E3> mergeFunction) throws E extends Exception, E2 extends Exception, E3 extends Exception
- Type Parameters:
K
- the key typeV
- the value typeE
-E2
-E3
-- Parameters:
keyMapper
-valueMapper
-mergeFunction
-- Returns:
- Throws:
E
- the eE2
- the e2E3
- the e3E extends Exception
-
toMap
public <K,V,M extends Map<K,V>,E extends Exception,E2 extends Exception,E3 extends Exception> M toMap(Throwables.ByteFunction<? extends K,E> keyMapper, Throwables.ByteFunction<? extends V,E2> valueMapper, Throwables.BinaryOperator<V,E3> mergeFunction, IntFunction<? extends M> mapFactory) throws E extends Exception, E2 extends Exception, E3 extends Exception
- Type Parameters:
K
- the key typeV
- the value typeM
-E
-E2
-E3
-- Parameters:
keyMapper
-valueMapper
-mergeFunction
-mapFactory
-- Returns:
- Throws:
E
- the eE2
- the e2E3
- the e3E extends Exception
-
toMap
public <K,A,D,E extends Exception> Map<K,D> toMap(Throwables.ByteFunction<? extends K,E> keyMapper, Collector<Byte,A,D> downstream) throws E extends Exception
- Type Parameters:
K
- the key typeA
-D
-E
-- Parameters:
keyMapper
-downstream
-- Returns:
- Throws:
E
- the eE extends Exception
-
toMap
public <K,A,D,M extends Map<K,D>,E extends Exception> M toMap(Throwables.ByteFunction<? extends K,E> keyMapper, Collector<Byte,A,D> downstream, IntFunction<? extends M> mapFactory) throws E extends Exception
- Type Parameters:
K
- the key typeA
-D
-M
-E
-- Parameters:
keyMapper
-downstream
-mapFactory
-- Returns:
- Throws:
E
- the eE extends Exception
-
iterator
public ByteIterator iterator()
- Returns:
-
stream
public ByteStream stream()
- Returns:
-
stream
public ByteStream stream(int fromIndex, int toIndex)
- Parameters:
fromIndex
-toIndex
-- Returns:
-
apply
public <R,E extends Exception> R apply(Throwables.Function<? super ByteList,R,E> func) throws E extends Exception
- Specified by:
apply
in classPrimitiveList<Byte,byte[],ByteList>
- Type Parameters:
R
-E
-- Parameters:
func
-- Returns:
- Throws:
E
- the eE extends Exception
-
applyIfNotEmpty
public <R,E extends Exception> u.Optional<R> applyIfNotEmpty(Throwables.Function<? super ByteList,R,E> func) throws E extends Exception
Apply if not empty.- Specified by:
applyIfNotEmpty
in classPrimitiveList<Byte,byte[],ByteList>
- Type Parameters:
R
-E
-- Parameters:
func
-- Returns:
- Throws:
E
- the eE extends Exception
-
accept
public <E extends Exception> void accept(Throwables.Consumer<? super ByteList,E> action) throws E extends Exception
- Specified by:
accept
in classPrimitiveList<Byte,byte[],ByteList>
- Type Parameters:
E
-- Parameters:
action
-- Throws:
E
- the eE extends Exception
-
acceptIfNotEmpty
public <E extends Exception> If.OrElse acceptIfNotEmpty(Throwables.Consumer<? super ByteList,E> action) throws E extends Exception
Accept if not empty.- Specified by:
acceptIfNotEmpty
in classPrimitiveList<Byte,byte[],ByteList>
- Type Parameters:
E
-- Parameters:
action
-- Throws:
E
- the eE extends Exception
-
equals
public boolean equals(Object obj)
-
-