U
- Type of the first element in a pairV
- Type of the second element in a pairpublic class PairList<U,V> extends Object
Modifier and Type | Class and Description |
---|---|
class |
PairList.Iterator
Special iterator class which we'll use to iterate through elements of
PairList , without having to create new object as wrapper for
each pair. |
Modifier and Type | Field and Description |
---|---|
protected List<U> |
firstList
List to keep first elements of pairs in
|
protected List<V> |
secondList
List to keep second elements of pairs in
|
Constructor and Description |
---|
PairList()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(U first,
V second)
Add a pair to the collection.
|
PairList.Iterator |
getIterator()
Get iterator through elements of this object.
|
int |
getSize()
Get number of pairs in this list.
|
void |
initialize()
Initialize the inner state.
|
void |
initialize(int size)
Initialize the inner state, with a known size.
|
boolean |
isEmpty()
Check if the list is empty.
|
public void initialize()
add()
is
called.public void initialize(int size)
add()
is called.size
- Number of pairs which will be added to the listpublic void add(U first, V second)
first
- First element of the pairsecond
- Second element of the pairpublic int getSize()
public boolean isEmpty()
public PairList.Iterator getIterator()
PairList.Iterator
iteratorCopyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.