E - the type of elements in this listpublic interface Column<E> extends List<E>
List backed by nio buffers. Elements of
type E are packed/unpacked to and from the buffers. There are four
variants for each element type, with different tradeoffs between performance
and functionality:
| Database Terminology |
isNonnull | isSorted | isDistinct | Spliteratorcharacteristics |
Find by Value / Binary Search |
|---|---|---|---|---|---|
| Heap, NULL | FALSE | FALSE | FALSE | ORDERED, IMMUTABLE |
O(n) No |
| Heap, NOT NULL | TRUE | FALSE | FALSE | ORDERED, IMMUTABLE,NONNULL |
O(n) No |
| Index | TRUE | TRUE | FALSE | ORDERED, IMMUTABLE,NONNULL, SORTED |
O(log(n)) Yes |
| Unique Index | TRUE | TRUE | TRUE | ORDERED, IMMUTABLE,NONNULL, SORTED,DISTINCT |
O(log(n)) Yes |
Additional Notes
| Modifier and Type | Field and Description |
|---|---|
static int |
BASE_CHARACTERISTICS |
| Modifier and Type | Method and Description |
|---|---|
Column<E> |
append(Column<E> tail)
Appends two columns with the same element type.
|
default Column<E> |
append(Column<E> tail,
boolean coerce)
Appends two columns with the same element type.
|
E |
ceiling(E value)
Returns the least element in this column greater than or equal to the given
element, or
null if there is no such element. |
int |
characteristics()
Returns the
Spliterator.characteristics() for this column. |
Comparator<? super E> |
comparator()
Returns the comparator used to order the elements in this column.
|
Column<E> |
copy()
Returns a column equal to this one, but with elements stored in a newly
allocated buffer.
|
E |
first()
Returns the first (lowest) element in this column.
|
E |
floor(E value)
Returns the greatest element in this column less than or equal to the given
element, or
null if there is no such element. |
ColumnType<E> |
getType() |
Column<E> |
head(E toElement)
Same behavior as
head(Object, boolean), with inclusive set
to false. |
Column<E> |
head(E toElement,
boolean inclusive)
Returns a view of the portion of this column whose elements are less than (or
equal to, if
inclusive is true) toElement. |
E |
higher(E value)
Returns the least element in this column strictly greater than the given
element, or
null if there is no such element. |
default boolean |
isDistinct()
Returns true if the
Spliterator.DISTINCT flag is set. |
default boolean |
isNonnull()
Returns true if the
Spliterator.NONNULL flag is set. |
boolean |
isNull(int index)
Test if a value is null at a given index.
|
default boolean |
isSorted()
Returns true if the
Spliterator.SORTED flag is set. |
E |
last()
Returns the last (highest) element in this column.
|
E |
lower(E value)
Returns the greatest element in this column strictly less than the given
element, or
null if there is no such element. |
default Spliterator<E> |
spliterator()
Creates a
Spliterator over the elements in this list. |
Column<E> |
subColumn(int fromIndex,
int toIndex)
Returns a view of the portion of this column between the specified
fromIndex, inclusive, and toIndex, exclusive.
|
Column<E> |
subColumnByValue(E fromElement,
boolean fromInclusive,
E toElement,
boolean toInclusive)
Returns a view of the portion of this column whose elements range from
fromElement to toElement. |
Column<E> |
subColumnByValue(E fromElement,
E toElement)
Same behavior as
Column#subColumn(Object, boolean, Object, Boolean),
with fromInclusive set to true and toInclusive set to false. |
Column<E> |
tail(E fromElement)
Same behavior as
tail(Object, boolean), with inclusive set
to true. |
Column<E> |
tail(E fromElement,
boolean inclusive)
Returns a view of the portion of this column whose elements are greater than
(or equal to, if
inclusive is true) fromElement. |
Column<E> |
toDistinct()
Converts a column to a unique index.
|
Column<E> |
toHeap()
Converts an index into a heap.
|
Column<E> |
toSorted()
Converts a heap to an index.
|
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, subList, toArray, toArrayparallelStream, removeIf, streamstatic final int BASE_CHARACTERISTICS
int characteristics()
Spliterator.characteristics() for this column.default boolean isNonnull()
Spliterator.NONNULL flag is set.NONNULL flag is set.default boolean isSorted()
Spliterator.SORTED flag is set.SORTED flag is set.default boolean isDistinct()
Spliterator.DISTINCT flag is set.DISTINCT flag is set.Column<E> toHeap()
isSorted() as
false. The resulting column shares the same underlying buffer as this
one.Column<E> toSorted()
characteristics() of this column:
SORTED flag
set. If not already sorted then copy() will be invoked, and the
resulting column will be sorted.
DISTINCT flag unset.
UnsupportedOperationException - if the NONNULL flag is not setColumn<E> toDistinct()
characteristics() of this column:
SORTED and DISTINCT flags set. If not already sorted and
distinct then copy() will be invoked, and the resulting column will
be sorted and deduplicated.
DISTINCT
flag set. If duplicates are present then copy() will be invoked, and
the resulting column will be deduplicated.
UnsupportedOperationException - if the NONNULL flag is not setColumnType<E> getType()
type.boolean isNull(int index)
index - the index to testColumn<E> subColumn(int fromIndex, int toIndex)
fromIndex - low endpoint (inclusive) of the subListtoIndex - high endpoint (exclusive) of the subListIndexOutOfBoundsException - for an illegal endpoint index value
(fromIndex < 0 || toIndex > size ||
fromIndex > toIndex)default Spliterator<E> spliterator()
Spliterator over the elements in this list.
The Spliterator reports SIZED,
SUBSIZED, ORDERED,
and IMMUTABLE.
spliterator in interface Collection<E>spliterator in interface Iterable<E>spliterator in interface List<E>Spliterator over the elements in this columnColumn<E> append(Column<E> tail)
Both columns must have the same characteristics. If they're both unique indices then the first value of the provided column must be greater than the last value of this column.
tail - - the column to be appended to the end of this columndefault Column<E> append(Column<E> tail, boolean coerce)
If coerce is true and one of the columns is sorted, the sorted column will be
converted to a heap before appending. Otherwise this method behaves like
append(Column)
tail - - the column to be appended to the end of this columncoerce - - specifies if a sole sorted column should be converted to a
heapColumn<E> copy()
Comparator<? super E> comparator()
E first()
NoSuchElementException - if this column is emptyE last()
NoSuchElementException - if this column is emptyE lower(E value)
null if there is no such element.value - the value to matche, or null if there is
no such elementUnsupportedOperationException - if column is not a unique index, i.e.
the DISTINCT flag is not setE higher(E value)
null if there is no such element.value - the value to matche, or null if there is
no such elementUnsupportedOperationException - if column is not a unique index, i.e.
the DISTINCT flag is not setE floor(E value)
null if there is no such element.value - the value to matche, or null
if there is no such elementUnsupportedOperationException - if column is not a unique index, i.e.
the DISTINCT flag is not setE ceiling(E value)
null if there is no such element.value - the value to matche, or null
if there is no such elementUnsupportedOperationException - if column is not a unique index, i.e.
the DISTINCT flag is not setColumn<E> subColumnByValue(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
fromElement to toElement. If fromElement and
toElement are equal, the returned column is empty unless fromInclusive and toInclusive are both true. The returned column is
backed by this column.
This method is only available when isDistinct() returns
true.
fromElement - low endpoint of the returned columnfromInclusive - true if the low endpoint is to be included in the resulttoElement - high endpoint of the returned columntoInclusive - true if the high endpoint is to be included in the
resultfromElement to toElementUnsupportedOperationException - if isDistinct() return falseIllegalArgumentException - if fromElement is greater than
toElementColumn<E> subColumnByValue(E fromElement, E toElement)
Column#subColumn(Object, boolean, Object, Boolean),
with fromInclusive set to true and toInclusive set to false.
This method is only available when isDistinct() returns
true.
fromElement - low endpoint of the returned column, inclusivetoElement - high endpoint of the returned column, exclusivefromElement, inclusive, to toElement, exclusiveColumn<E> head(E toElement, boolean inclusive)
inclusive is true) toElement. The returned
column is backed by this column.
This method is only available when isDistinct() returns
true.
toElement - high endpoint of the returned columninclusive - true if the high endpoint is to be included in the
returned viewinclusive is true) toElementUnsupportedOperationException - if isDistinct() return falseColumn<E> head(E toElement)
head(Object, boolean), with inclusive set
to false.
This method is only available when isDistinct() returns
true.
toElement - high endpoint of the returned columntoElementColumn<E> tail(E fromElement, boolean inclusive)
inclusive is true) fromElement. The returned
column is backed by this column.
This method is only available when isDistinct() returns
true.
fromElement - low endpoint of the returned columninclusive - true if the low endpoint is to be included in the
returned viewfromElementUnsupportedOperationException - if isDistinct() return falseColumn<E> tail(E fromElement)
tail(Object, boolean), with inclusive set
to true.
This method is only available when isDistinct() returns
true.
fromElement - low endpoint of the returned columnfromElementCopyright © 2020. All rights reserved.