T
- element typepublic class RichArray<T> extends Object implements List<T>, IntFunction<T>, RandomAccess, Serializable, Cloneable
Instances of this class are backed by a plain Java array. The reference to this array never changes. It is impossible to obtain an outside reference to the backing array; however, if an array is supplied to a constructor of this class, all methods of this class manipulate the original array.
This class was designed for efficiency. The many methods it offers are intended to allow direct
manipulation of the backing array as often as possible, eliminating the indirection via
get(int)
and update(int, Object)
methods.
This class is designed to "feel" like an array as much as possible. This includes:
public final
field length
List
interface. Note, however, that none of the
optional methods are implemented.Modifier and Type | Field and Description |
---|---|
int |
length |
Constructor and Description |
---|
RichArray(Collection<? extends T> coll) |
RichArray(int length) |
RichArray(int length,
IntFunction<? extends T> initializer) |
RichArray(int length,
Supplier<? extends T> valueSupp) |
RichArray(int length,
T value) |
RichArray(T[] contents) |
RichArray(T[] contents,
int start,
int end) |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
T element)
Deprecated.
|
boolean |
add(T e)
Deprecated.
|
boolean |
addAll(Collection<? extends T> c)
Deprecated.
|
boolean |
addAll(int index,
Collection<? extends T> c)
Deprecated.
|
T |
apply(int value) |
int |
binarySearch(int startInclusive,
int endExclusive,
T key,
Comparator<? super T> cmp) |
int |
binarySearch(T key,
Comparator<? super T> cmp) |
void |
clear()
Deprecated.
|
RichArray<T> |
clone() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
contentDeepEquals(Object[] array) |
boolean |
contentDeepEquals(Object[] array,
int start,
int end) |
boolean |
contentEquals(Object[] array) |
boolean |
contentEquals(Object[] array,
int start,
int end) |
RichArray<T> |
copyFrom(T[] source,
int sourceOfs,
int destOfs,
int len) |
RichArray<T> |
copyInto(int sourceOfs,
Object[] dest,
int destOfs,
int len) |
boolean |
equals(List<?> other) |
boolean |
equals(Object o) |
boolean |
equals(RichArray<?> other) |
T |
get(int index) |
int |
hashCode() |
int |
indexOf(Object o) |
boolean |
isEmpty() |
Iterator<T> |
iterator() |
int |
lastIndexOf(Object o) |
ListIterator<T> |
listIterator() |
ListIterator<T> |
listIterator(int index) |
T |
max() |
T |
max(Comparator<? super T> cmp) |
int |
maxIndex() |
int |
maxIndex(Comparator<? super T> cmp) |
T |
min() |
T |
min(Comparator<? super T> cmp) |
int |
minIndex() |
int |
minIndex(Comparator<? super T> cmp) |
void |
parallelPrefix(BinaryOperator<T> op) |
void |
parallelPrefix(int startInclusive,
int endExclusive,
BinaryOperator<T> op) |
void |
parallelSetAll(IntFunction<? extends T> generator) |
void |
parallelSetAll(int startInclusive,
int endExclusive,
IntFunction<? extends T> generator) |
void |
parallelSetAll(int startInclusive,
int endExclusive,
Supplier<? extends T> supplier) |
void |
parallelSetAll(int startInclusive,
int endExclusive,
T value) |
void |
parallelSetAll(Supplier<? extends T> supplier) |
void |
parallelSetAll(T value) |
void |
parallelSort() |
void |
parallelSort(Comparator<? super T> cmp) |
void |
parallelSort(int startInclusive,
int endExclusive) |
void |
parallelSort(int startInclusive,
int endExclusive,
Comparator<? super T> cmp) |
RichArray<T> |
parallelTransform(Function<? super T,? extends T> transformer) |
RichArray<T> |
parallelTransform(int startInclusive,
int endExclusive,
Function<? super T,? extends T> transformer) |
RichArray<T> |
parallelTransformWithIndex(int startInclusive,
int endExclusive,
WithIndexTransformer<? super T,? extends T> transformer) |
RichArray<T> |
parallelTransformWithIndex(WithIndexTransformer<? super T,? extends T> transformer) |
T |
remove(int index)
Deprecated.
|
boolean |
remove(Object o)
Deprecated.
|
boolean |
removeAll(Collection<?> c)
Deprecated.
|
boolean |
retainAll(Collection<?> c)
Deprecated.
|
void |
reverse() |
T |
set(int index,
T element) |
void |
setAll(IntFunction<? extends T> generator) |
void |
setAll(int startInclusive,
int endExclusive,
IntFunction<? extends T> generator) |
void |
setAll(int startInclusive,
int endExclusive,
Supplier<? extends T> supplier) |
void |
setAll(int startInclusive,
int endExclusive,
T value) |
void |
setAll(Supplier<? extends T> supplier) |
void |
setAll(T value) |
void |
shuffle() |
void |
shuffle(Random r) |
int |
size() |
RichArray<T> |
slice(int fromIndex,
int toIndex) |
void |
sort() |
void |
sort(Comparator<? super T> cmp) |
void |
sort(int startInclusive,
int endExclusive) |
void |
sort(int startInclusive,
int endExclusive,
Comparator<? super T> cmp) |
Spliterator<T> |
spliterator() |
Spliterator<T> |
spliterator(int startInclusive,
int endExclusive) |
RichArray<T> |
subList(int fromIndex,
int toIndex)
Deprecated.
|
void |
swap(int i,
int j) |
Object[] |
toArray() |
<U> U[] |
toArray(U[] a) |
void |
transform(Function<? super T,? extends T> transformer) |
void |
transform(int startInclusive,
int endExclusive,
Function<? super T,? extends T> transformer) |
void |
transformSingle(int index,
Function<? super T,? extends T> transformer) |
RichArray<T> |
transformWithIndex(int startInclusive,
int endExclusive,
WithIndexTransformer<? super T,? extends T> transformer) |
RichArray<T> |
transformWithIndex(WithIndexTransformer<? super T,? extends T> transformer) |
void |
update(int index,
T element) |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
replaceAll
parallelStream, removeIf, stream
public RichArray(int length)
public RichArray(T[] contents, int start, int end)
public RichArray(T[] contents)
public RichArray(Collection<? extends T> coll)
public RichArray(int length, T value)
public RichArray(int length, IntFunction<? extends T> initializer)
public int hashCode()
public boolean equals(Object o)
public boolean contentEquals(Object[] array)
public boolean contentEquals(Object[] array, int start, int end)
public boolean contentDeepEquals(Object[] array)
public boolean contentDeepEquals(Object[] array, int start, int end)
public int size()
public boolean isEmpty()
public boolean contains(Object o)
public Object[] toArray()
public <U> U[] toArray(U[] a)
@Deprecated public boolean add(T e)
@Deprecated public boolean remove(Object o)
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<T>
containsAll
in interface List<T>
@Deprecated public boolean addAll(Collection<? extends T> c)
@Deprecated public boolean addAll(int index, Collection<? extends T> c)
@Deprecated public boolean removeAll(Collection<?> c)
@Deprecated public boolean retainAll(Collection<?> c)
@Deprecated public void clear()
public void update(int index, T element)
@Deprecated public void add(int index, T element)
@Deprecated public T remove(int index)
public int lastIndexOf(Object o)
lastIndexOf
in interface List<T>
public ListIterator<T> listIterator()
listIterator
in interface List<T>
public ListIterator<T> listIterator(int index)
listIterator
in interface List<T>
@Deprecated public RichArray<T> subList(int fromIndex, int toIndex)
public void sort(Comparator<? super T> cmp)
public void sort()
public void parallelSort(Comparator<? super T> cmp)
public void parallelSort()
public void sort(int startInclusive, int endExclusive, Comparator<? super T> cmp)
public void sort(int startInclusive, int endExclusive)
public void parallelSort(int startInclusive, int endExclusive, Comparator<? super T> cmp)
public void parallelSort(int startInclusive, int endExclusive)
public void parallelPrefix(BinaryOperator<T> op)
public void parallelPrefix(int startInclusive, int endExclusive, BinaryOperator<T> op)
public int binarySearch(T key, Comparator<? super T> cmp)
public int binarySearch(int startInclusive, int endExclusive, T key, Comparator<? super T> cmp)
public void parallelSetAll(IntFunction<? extends T> generator)
public void parallelSetAll(int startInclusive, int endExclusive, IntFunction<? extends T> generator)
public void setAll(IntFunction<? extends T> generator)
public void setAll(int startInclusive, int endExclusive, IntFunction<? extends T> generator)
public void parallelSetAll(T value)
public void parallelSetAll(int startInclusive, int endExclusive, T value)
public void setAll(T value)
public void setAll(int startInclusive, int endExclusive, T value)
public void parallelSetAll(int startInclusive, int endExclusive, Supplier<? extends T> supplier)
public void swap(int i, int j)
public void shuffle(Random r)
public void shuffle()
public void reverse()
public Spliterator<T> spliterator()
spliterator
in interface Iterable<T>
spliterator
in interface Collection<T>
spliterator
in interface List<T>
public Spliterator<T> spliterator(int startInclusive, int endExclusive)
public int minIndex()
public int minIndex(Comparator<? super T> cmp)
public T min()
public T min(Comparator<? super T> cmp)
public int maxIndex()
public int maxIndex(Comparator<? super T> cmp)
public T max()
public T max(Comparator<? super T> cmp)
public void transform(int startInclusive, int endExclusive, Function<? super T,? extends T> transformer)
public RichArray<T> parallelTransform(Function<? super T,? extends T> transformer)
public RichArray<T> parallelTransform(int startInclusive, int endExclusive, Function<? super T,? extends T> transformer)
public RichArray<T> transformWithIndex(WithIndexTransformer<? super T,? extends T> transformer)
public RichArray<T> transformWithIndex(int startInclusive, int endExclusive, WithIndexTransformer<? super T,? extends T> transformer)
public RichArray<T> parallelTransformWithIndex(WithIndexTransformer<? super T,? extends T> transformer)
public RichArray<T> parallelTransformWithIndex(int startInclusive, int endExclusive, WithIndexTransformer<? super T,? extends T> transformer)
public T apply(int value)
apply
in interface IntFunction<T>
Copyright © 2015. All rights reserved.