E - the type of elements in this listpublic interface Column<E> extends List<E>, NavigableSet<E>
E are packed/unpacked to and from the backing array. Columns
implement both List and NavigableSet. List is the
primary interface, and all List methods are always available. There
are (up to) three concrete implementations of a Column for each
element type, with different tradeoffs between performance and functionality.
The methods isNullable() and isSortedSet() can be used to
determine the characteristics of a particular column:
| Database Terminology |
Implementation | isNullable | isSortedSet | Spliteratorcharacteristics |
Get by Index /RandomAccess |
Find by Value/ Binary Search |
|---|---|---|---|---|---|---|
| Heap, NULL | NullableColumn |
TRUE | FALSE | ORDERED, IMMUTABLE |
O(n) / FALSE | O(n) / FALSE |
| Heap, NOT NULL | NonNullColumnsortedSet=FALSE |
FALSE | FALSE | ORDERED, IMMUTABLE,NONNULL |
O(1) / TRUE | O(n) / FALSE |
| Unique Index | NonNullColumnsortedSet=TRUE |
FALSE | TRUE | ORDERED, IMMUTABLE,NONNULL,SORTED, DISTINCT |
O(1) / TRUE | O(log(n)) / TRUE |
Note: NavigableSet operations are only available for
unique indices (i.e., when isSortedSet() -> true)! They will
throw UnsupportedOperationException otherwise.
All concrete implementations of Column must be done via
AbstractColumn. It is not enough to simply implement this interface.
| 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.
|
ColumnType |
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. |
boolean |
isNull(int index)
Test if a value is null at a given index.
|
boolean |
isNullable()
Indicates the nullability of this column.
|
boolean |
isSortedSet()
The array organization of this column: either a free-form heap, or a unique
index.
|
default Spliterator<E> |
spliterator()
Creates a
Spliterator over the elements in this list. |
Column<E> |
subColumn(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> |
subColumn(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> |
subColumn(int fromIndex,
int toIndex)
Returns a view of the portion of this column between the specified
fromIndex, inclusive, and toIndex, exclusive.
|
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> |
toHeap()
Converts a unique index into a heap.
|
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, toArrayceiling, descendingIterator, descendingSet, floor, headSet, headSet, higher, iterator, lower, pollFirst, pollLast, subSet, subSet, tailSet, tailSetcomparator, first, lastparallelStream, removeIf, streamboolean isNullable()
boolean isSortedSet()
Column<E> toHeap()
isSortedSet() as
falseColumnType 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)Column<E> subColumn(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 isSortedSet() returns
true.
fromElement - low endpoint of the returned columnfromInclusive - true if the low endpoint is to be included in the
returned viewtoElement - high endpoint of the returned columntoInclusive - true if the high endpoint is to be included in the
returned viewfromElement to toElementUnsupportedOperationException - if isSortedSet() return falseClassCastException - if fromElement and
toElement do not match type
ENullPointerException - if fromElement or
toElement is nullIllegalArgumentException - if fromElement is greater than
toElementColumn<E> subColumn(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 isSortedSet() 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 isSortedSet() 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 isSortedSet() return falseClassCastException - if toElement is not compatible
with this column's element type.NullPointerException - if toElement is nullColumn<E> head(E toElement)
head(Object, boolean), with inclusive set
to false.
This method is only available when isSortedSet() 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 isSortedSet() returns
true.
fromElement - low endpoint of the returned columninclusive - true if the low endpoint is to be included in the
returned viewfromElementUnsupportedOperationException - if isSortedSet() return falseClassCastException - if fromElement is not
compatible with this column's element
type.NullPointerException - if fromElement is nullColumn<E> tail(E fromElement)
tail(Object, boolean), with inclusive set
to true.
This method is only available when isSortedSet() returns
true.
fromElement - low endpoint of the returned columnfromElementdefault Spliterator<E> spliterator()
Spliterator over the elements in this list.
spliterator in interface Collection<E>spliterator in interface Iterable<E>spliterator in interface List<E>spliterator in interface Set<E>spliterator in interface SortedSet<E>Spliterator over the elements in this columnColumn<E> append(Column<E> tail)
Both columns must either be unique indices or not. 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 exactly one of the columns is a unique index, the
unique index 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 the sole unique index should be converted to a
heapCopyright © 2019. All rights reserved.