A
- a generic placeholder for any type which will be the first of the
Pair.B
- a generic placeholder for any type which will be the second of the
Pairpublic class ArrayPairList<A,B> extends java.util.ArrayList<Pair<A,B>> implements PairList<A,B>
Constructor and Description |
---|
ArrayPairList() |
ArrayPairList(java.util.Collection<Pair<A,B>> arg0) |
ArrayPairList(int initialCapacity) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsFirstType(A a)
Returns true if the list conatains an object of type Pair whose first
component matches the argument.
|
boolean |
containsSecondType(B b)
Returns true if the list conatains an object of type Pair whose second component matches the argument.
|
int |
indexOfFirstType(A a)
Returns the index of the first occurrence of the specified element in
this list, or -1 if this list does not contain the element.
|
int |
indexOfSecondType(B b)
Returns the index of the first occurrence of the specified element in
this list, or -1 if this list does not contain the element.
|
int |
lastIndexOfFirstType(A a)
Returns the index of the last occurrence of the specified element, where
the first element matches the first element of the entry in this
list, or -1 if this list does not contain the element.
|
int |
lastIndexOfSecondType(B b)
Returns the index of the last occurrence of the specified element, where
the second element matches the second element of the entry in this
list, or -1 if this list does not contain the element.
|
boolean |
removeByFirstType(A a)
Removes the first occurence of a Pair whose first matches the first of an
entry in the list.
|
boolean |
removeBySecondType(B b)
Removes the first occurence of a Pair whose second element matches the second of
Pair entry in the list.
|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeRange, retainAll, set, size, subList, toArray, toArray, trimToSize
public ArrayPairList()
public ArrayPairList(int initialCapacity)
public boolean containsFirstType(A a)
containsFirstType
in interface PairList<A,B>
a
- The object to lookup, standard arraylist semantics for equality
are used.public boolean containsSecondType(B b)
PairList
containsSecondType
in interface PairList<A,B>
b
- The object to lookup, standard arraylist semantics for equality are used.public int indexOfFirstType(A a)
PairList
indexOfFirstType
in interface PairList<A,B>
public int indexOfSecondType(B b)
PairList
indexOfSecondType
in interface PairList<A,B>
public int lastIndexOfFirstType(A a)
PairList
lastIndexOfFirstType
in interface PairList<A,B>
public int lastIndexOfSecondType(B b)
PairList
lastIndexOfSecondType
in interface PairList<A,B>
public boolean removeByFirstType(A a)
PairList
removeByFirstType
in interface PairList<A,B>
a
- The object of type A to be removed.public boolean removeBySecondType(B b)
PairList
removeBySecondType
in interface PairList<A,B>
b
- The object of type B to be removed.