@Immutable public final class IdBox<T> extends Object implements KeyedObject
A box that associates an object with an ID.
Constructor and Description |
---|
IdBox(long k,
T o)
Construct a new ID box.
|
Modifier and Type | Method and Description |
---|---|
static <T> IdBox<T> |
create(long id,
T obj)
Construct a new ID box.
|
boolean |
equals(Object o) |
long |
getId()
Get the ID associated with the object.
|
long |
getKey()
Get the key for this object.
|
T |
getValue()
Get the value associated with the object.
|
int |
hashCode() |
String |
toString() |
public IdBox(long k, T o)
Construct a new ID box.
k
- The ID.o
- The object.public static <T> IdBox<T> create(long id, T obj)
Construct a new ID box.
id
- The ID.obj
- The object.T
- The object type.obj
with id
.public long getId()
Get the ID associated with the object.
public long getKey()
KeyedObject
Get the key for this object.
getKey
in interface KeyedObject
public T getValue()
Get the value associated with the object.