Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

oracle.javatools.util
Class ArrayPairList<A,B>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<Pair<A,B>>
              extended by oracle.javatools.util.ArrayPairList<A,B>
Type Parameters:
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 Pair
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Pair<A,B>>, java.util.Collection<Pair<A,B>>, java.util.List<Pair<A,B>>, java.util.RandomAccess, PairList<A,B>

public class ArrayPairList<A,B>
extends java.util.ArrayList<Pair<A,B>>
implements PairList<A,B>

ArrayPairList is an ArrayList that extends ArrayList and implements the PairList (which extends the List interface) to support Pairs of generic types, say Pair of A,B. The class behaves like an array list except for various search and selection methods which have *FirstType() versions, for example indexOfFirstType( A a) which looks for a Pair whose first member of type A matches the argument A.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ArrayPairList()
           
ArrayPairList(java.util.Collection<Pair<A,B>> arg0)
           
ArrayPairList(int initialCapacity)
           
 
Method Summary
 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.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Constructor Detail

ArrayPairList

public ArrayPairList()

ArrayPairList

public ArrayPairList(int initialCapacity)

ArrayPairList

public ArrayPairList(java.util.Collection<Pair<A,B>> arg0)
Parameters:
arg0 -
Method Detail

containsFirstType

public boolean containsFirstType(A a)
Returns true if the list conatains an object of type Pair whose first component matches the argument.

Specified by:
containsFirstType in interface PairList<A,B>
Parameters:
a - The object to lookup, standard arraylist semantics for equality are used.
Returns:
boolean true if a Pair with the same first element exists in the list.

containsSecondType

public boolean containsSecondType(B b)
Description copied from interface: PairList
Returns true if the list conatains an object of type Pair whose second component matches the argument.

Specified by:
containsSecondType in interface PairList<A,B>
Parameters:
b - The object to lookup, standard arraylist semantics for equality are used.
Returns:
boolean true if a Pair with the same second element exists in the list.

indexOfFirstType

public int indexOfFirstType(A a)
Description copied from interface: PairList
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))) , or -1 if there is no such index.

Specified by:
indexOfFirstType in interface PairList<A,B>
Returns:

indexOfSecondType

public int indexOfSecondType(B b)
Description copied from interface: PairList
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))) , or -1 if there is no such index.

Specified by:
indexOfSecondType in interface PairList<A,B>
Returns:

lastIndexOfFirstType

public int lastIndexOfFirstType(A a)
Description copied from interface: PairList
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. *

Specified by:
lastIndexOfFirstType in interface PairList<A,B>
Returns:

lastIndexOfSecondType

public int lastIndexOfSecondType(B b)
Description copied from interface: PairList
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.

Specified by:
lastIndexOfSecondType in interface PairList<A,B>
Returns:

removeByFirstType

public boolean removeByFirstType(A a)
Description copied from interface: PairList
Removes the first occurence of a Pair whose first matches the first of an entry in the list. Returns false in no match was found.

Specified by:
removeByFirstType in interface PairList<A,B>
Parameters:
a - The object of type A to be removed.
Returns:
boolean true if a match was found and removed, otherwise false.

removeBySecondType

public boolean removeBySecondType(B b)
Description copied from interface: PairList
Removes the first occurence of a Pair whose second element matches the second of Pair entry in the list. Returns false in no match was found.

Specified by:
removeBySecondType in interface PairList<A,B>
Parameters:
b - The object of type B to be removed.
Returns:
boolean true if a match was found and removed, otherwise false.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

Copyright © 1997, 2011, Oracle. All rights reserved.