E - type of elements stored in the listpublic class KeyListImpl<E> extends GapList<E>
GapList,
Serialized FormDEFAULT_CAPACITY| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E elem)
Appends the specified element to the end of this list (optional
operation).
|
void |
add(int index,
E elem)
Inserts the specified element at the specified position in this list
(optional operation).
|
boolean |
addIf(E elem)
Adds element if allowed and returns true.
|
java.util.Set<E> |
asSet()
Returns a set view of the collection.
|
<K> int |
binarySearch(int index,
int len,
K key,
java.util.Comparator<? super K> comparator)
Searches the specified range for an object using the binary
search algorithm.
|
int |
capacity()
Returns capacity of this GapList.
|
void |
clear()
Removes all of the elements from this list (optional operation).
|
java.lang.Object |
clone()
Returns a shallow copy of this GapList instance
(The elements themselves are not copied).
|
boolean |
contains(java.lang.Object elem)
Returns true if this collection contains the specified element.
|
boolean |
containsKey(int keyIndex,
java.lang.Object key)
Checks whether the specified key exists in this list.
|
KeyListImpl |
copy()
Returns a shallow copy of this GapList instance
(the new list will contain the same elements as the source list, i.e. the elements themselves are not copied).
|
static <E> GapList<E> |
create()
Do not use.
|
static <E> GapList<E> |
create(java.util.Collection<? extends E> coll)
Do not use.
|
static <E> GapList<E> |
create(E... elems)
Do not use.
|
static <E> GapList<E> |
create(int capacity)
Do not use.
|
KeyListImpl |
crop()
Returns a copy this list but without elements.
|
void |
ensureCapacity(int minCapacity)
Increases the capacity of this GapList instance, if
necessary, to ensure that it can hold at least the number of elements
specified by the minimum capacity argument.
|
E |
get(int index)
Returns the element at the specified position in this list.
|
GapList<E> |
getAll(E elem)
Returns all elements in the list equal to the specified element.
|
GapList<E> |
getAllByKey(int keyIndex,
java.lang.Object key)
Returns a list with all elements with the specified key.
|
E |
getByKey(int keyIndex,
java.lang.Object key)
Returns value for given key.
|
int |
getCount(E elem)
Counts how many times the specified element is contained in the list.
|
int |
getCountByKey(int keyIndex,
java.lang.Object key)
Returns number of elements with specified key.
|
java.util.Set<E> |
getDistinct()
Returns distinct elements in the list.
|
java.util.Set<?> |
getDistinctKeys(int keyIndex)
Returns list containing all distinct keys.
|
Mapper<E,java.lang.Object> |
getKeyMapper(int keyIndex)
Returns mapper for specified key map.
|
int |
indexOf(java.lang.Object elem)
Returns the index of the first occurrence of the specified element
in this list, or -1 if this list does not contain the element.
|
int |
indexOfKey(int keyIndex,
java.lang.Object key)
Find given key and return its index.
|
int |
indexOfKey(int keyIndex,
java.lang.Object key,
int start)
Find given key and return its index.
|
GapList<E> |
removeAll(E elem)
Removes all equal elements.
|
E |
set(int index,
E elem)
Replaces the element at the specified position in this list with the
specified element (optional operation).
|
int |
size()
Returns the number of elements in this collection.
|
void |
sort(int index,
int len,
java.util.Comparator<? super E> comparator)
Sort specified elements in the list using the specified comparator.
|
doCreate, EMPTY, getAll, getDefaultElem, init, init, init, init, mappedList, remove, trimToSize, unmodifiableListaddAll, addAll, addAll, addAll, addAll, addAll, addFirst, addIfAbsent, addLast, binarySearch, containsAll, containsAny, copy, copy, descendingIterator, drag, element, equals, fill, fill, filter, getArray, getFirst, getLast, hashCode, init, isEmpty, iterator, lastIndexOf, listIterator, listIterator, move, move, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeAll, removeAll, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, resize, retainAll, retainAll, reverse, reverse, rotate, rotate, setAll, setAll, setAll, sort, swap, swap, toArray, toArray, toArray, toStringpublic static <E> GapList<E> create()
public static <E> GapList<E> create(int capacity)
public static <E> GapList<E> create(java.util.Collection<? extends E> coll)
public static <E> GapList<E> create(E... elems)
public java.lang.Object clone()
IListpublic KeyListImpl copy()
IListcopy in class GapList<E>IList.clone()public KeyListImpl crop()
public java.util.Set<E> asSet()
public int capacity()
IListpublic int size()
java.util.Collectionpublic E get(int index)
java.util.AbstractListpublic boolean contains(java.lang.Object elem)
java.util.AbstractCollectionThis implementation iterates over the elements in the collection, checking each element in turn for equality with the specified element.
contains in interface java.util.Collection<E>contains in interface java.util.Deque<E>contains in interface java.util.List<E>contains in class IList<E>elem - element whose presence in this collection is to be testedpublic boolean add(E elem)
Lists that support this operation may place limitations on what elements may be added to this list. In particular, some lists will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. List classes should clearly specify in their documentation any restrictions on what elements may be added.
This implementation calls add(size(), e).
Note that this implementation throws an
UnsupportedOperationException unless
add(int, E) is overridden.
Note that the behavior of the operation depends on the defined constraints.
add in interface java.util.Collection<E>add in interface java.util.Deque<E>add in interface java.util.List<E>add in interface java.util.Queue<E>add in class GapList<E>elem - element to be appended to this listtrue (as specified by Collection.add(E))public boolean addIf(E elem)
elem - element to addpublic void add(int index,
E elem)
This implementation always throws an
UnsupportedOperationException.
Note that the behavior of the operation depends on the defined constraints.
public E set(int index, E elem)
This implementation always throws an
UnsupportedOperationException.
Note that the behavior of the operation depends on the defined constraints.
public void clear()
java.util.AbstractListThis implementation calls removeRange(0, size()).
Note that this implementation throws an
UnsupportedOperationException unless remove(int
index) or removeRange(int fromIndex, int toIndex) is
overridden.
public void ensureCapacity(int minCapacity)
IListensureCapacity in class IList<E>minCapacity - the desired minimum capacitypublic int indexOf(java.lang.Object elem)
java.util.AbstractListThis implementation first gets a list iterator (with
listIterator()). Then, it iterates over the list until the
specified element is found or the end of the list is reached.
public int indexOfKey(int keyIndex,
java.lang.Object key)
keyIndex - key indexkey - key to findpublic int indexOfKey(int keyIndex,
java.lang.Object key,
int start)
keyIndex - key indexkey - key to findstart - start index for searchpublic boolean containsKey(int keyIndex,
java.lang.Object key)
keyIndex - key indexkey - key to look forpublic Mapper<E,java.lang.Object> getKeyMapper(int keyIndex)
keyIndex - key indexpublic E getByKey(int keyIndex, java.lang.Object key)
keyIndex - key indexkey - key to findpublic GapList<E> getAllByKey(int keyIndex, java.lang.Object key)
keyIndex - key indexkey - key which elements must havepublic int getCountByKey(int keyIndex,
java.lang.Object key)
keyIndex - key indexkey - key which elements must havepublic java.util.Set<?> getDistinctKeys(int keyIndex)
keyIndex - key indexpublic <K> int binarySearch(int index,
int len,
K key,
java.util.Comparator<? super K> comparator)
IListbinarySearch in class GapList<E>index - index of first element to searchlen - number of elements to searchkey - the value to be searched forcomparator - the comparator by which the list is ordered.
A null value indicates that the elements'
natural ordering should be used.Arrays.binarySearch(long[], long)public void sort(int index,
int len,
java.util.Comparator<? super E> comparator)
IListpublic GapList<E> getAll(E elem)
IListpublic int getCount(E elem)
IListpublic GapList<E> removeAll(E elem)
IListpublic java.util.Set<E> getDistinct()
IListgetDistinct in class IList<E>