Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

oracle.javatools.util
Interface PairList<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 Superinterfaces:
java.util.Collection<Pair<A,B>>, java.lang.Iterable<Pair<A,B>>, java.util.List<Pair<A,B>>
All Known Implementing Classes:
ArrayPairList

public interface PairList<A,B>
extends java.util.List<Pair<A,B>>

PairList extends List interface to support Pair types which are in turn made of two arbitrary types. The PairList fills a gap between Lists and Maps. Maps do not allow duplicate but sometimes we would like to have a list that supports name-value pairs, with searching, deleting etcs by either name or value, and yet have the semantics of a 'List', and allow duplicate names. the PairList attepmts to fill this need.


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 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
 

Method Detail

indexOfFirstType

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. 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.

Parameters:
a -
Returns:

indexOfSecondType

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. 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.

Parameters:
b -
Returns:

lastIndexOfFirstType

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. *

Parameters:
a -
Returns:

lastIndexOfSecondType

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.

Parameters:
b -
Returns:

removeByFirstType

boolean removeByFirstType(A a)
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.

Parameters:
a - The object of type A to be removed.
Returns:
boolean true if a match was found and removed, otherwise false.

removeBySecondType

boolean removeBySecondType(B b)
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.

Parameters:
b - The object of type B to be removed.
Returns:
boolean true if a match was found and removed, otherwise false.

containsFirstType

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

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

boolean containsSecondType(B b)
Returns true if the list conatains an object of type Pair whose second component matches the argument.

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.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

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