java.lang.Object | |
↳ | com.pnfsoftware.jeb.util.collect.MultiList<E> |
A list of lists to be used as a fast-access multi-map for cases where the key is an integer index
located in a compact [0, N] range. Use with caution: if the input key range is sparse, it is
better to use a MultiMap
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
MultiList()
Create a new multi-list.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
List<E> |
clear(int index)
Clear a bucket.
| ||||||||||
void | clear() | ||||||||||
List<E> | findAllElements(int index, Predicate<E> check) | ||||||||||
E | findFirstElement(int index, Predicate<E> check) | ||||||||||
List<E> |
get(int index)
Retrieve the elements stored in an indexed bucket.
| ||||||||||
NavigableSet<Integer> | indexSet() | ||||||||||
boolean | isEmpty() | ||||||||||
int |
put(int index, E elt)
Add an element to a bucket.
| ||||||||||
void | putAll(List<List<? extends E>> c) | ||||||||||
void |
putMulti(int index, Collection<? extends E> values)
Add multiple elements mapped by the same key.
| ||||||||||
List<E> |
remove(int index)
Remove a bucket and shift subsequent bucket entries.
| ||||||||||
boolean |
removeElement(int index, E value)
Remove an element from a bucket.
| ||||||||||
int |
removeMultipleElements(int index, Predicate<E> check)
Remove elements from a bucket.
| ||||||||||
int |
size()
Get the total number of elements stored in all the buckets.
| ||||||||||
String | toString() | ||||||||||
Collection<E> | values() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Create a new multi-list.
Clear a bucket. The bucket stays.
Retrieve the elements stored in an indexed bucket.
Add an element to a bucket.
Add multiple elements mapped by the same key.
Remove a bucket and shift subsequent bucket entries. Eg, removing the bucket at index 10 means that buckets previously at indexes 11, 12, ..., N will be at indexes 10, 11, ..., N-1. Mind the unusual semantic of this operation.
Remove an element from a bucket.
value | the element to be removed |
---|
Remove elements from a bucket.
Get the total number of elements stored in all the buckets.