Package pascal.taie.util
Class SimpleIndexer<E>
java.lang.Object
pascal.taie.util.SimpleIndexer<E>
- All Implemented Interfaces:
Serializable
,Indexer<E>
A simple map and list based implementation of
Indexer
.
The indexes of the objects are same as their indexes in the list.
If getIndex(Object)
is called with an object that was absent
in this indexer, it will be added to the indexer automatically.
If getObject(int)
is called with an index that does not
map to any object, an IllegalArgumentException
will be thrown.
If you want to obtain an object of its corresponding index by
getObject(i)
, make sure that the object has been indexed by
getIndex(o)
.
- See Also:
-
Constructor Summary
ConstructorDescriptionConstructs an empty indexer.SimpleIndexer
(int initialCapacity) Constructs an empty mapper with the specified initial capacity.SimpleIndexer
(Collection<? extends E> c) Constructs a mapper with a collection. -
Method Summary
-
Constructor Details
-
SimpleIndexer
public SimpleIndexer()Constructs an empty indexer. -
SimpleIndexer
public SimpleIndexer(int initialCapacity) Constructs an empty mapper with the specified initial capacity. -
SimpleIndexer
Constructs a mapper with a collection. The elements in the collection will be added to the new-created mapper.
-
-
Method Details