public abstract class IdIndexMapping extends Object implements Serializable
Constructor and Description |
---|
IdIndexMapping() |
Modifier and Type | Method and Description |
---|---|
boolean |
containsId(long id)
Query whether this index contains a particular ID.
|
static IdIndexMapping |
create(Collection<? extends Long> ids) |
abstract long |
getId(int idx)
Get the ID for an index.
|
abstract LongList |
getIdList()
Get the list of indexed IDs.
|
int |
getIndex(long id)
Get the index of an ID.
|
abstract int |
size()
Get the size of this index.
|
abstract int |
tryGetIndex(long id)
Try to get the index for an ID, returning a negative value if it does not exist.
|
public int getIndex(long id)
id
- The ID to query.IllegalArgumentException
- if the ID is not in the index.public boolean containsId(long id)
id
- The ID to look for.true
if the index contains the ID.public abstract int tryGetIndex(long id)
getIndex(long)
, except it returns a negative value
instead of throwing an exception if the id does not exist.id
- The ID to look for.public abstract long getId(int idx)
idx
- The index of the ID to retrieve.IndexOutOfBoundsException
- if idx
is not a valid index.public abstract int size()
public abstract LongList getIdList()
public static IdIndexMapping create(Collection<? extends Long> ids)