Plexus v0.13.1

com.phoenixst.collections
Class UnorderedPair

java.lang.Object
  extended by java.util.AbstractCollection
      extended by com.phoenixst.collections.AbstractUnmodifiableCollection
          extended by com.phoenixst.collections.UnorderedPair
All Implemented Interfaces:
Serializable, Iterable, Collection

public class UnorderedPair
extends AbstractUnmodifiableCollection
implements Serializable

A simple mutable unordered pair implementation. The individual elements may be changed, but the size of this implementation cannot. For convenience, the elements are referred to as "first" and "second", but this has no effect on .equals().

Since:
1.0
Version:
$Revision: 1.4 $
Author:
Ray A. Conner
See Also:
Serialized Form

Constructor Summary
UnorderedPair()
           
UnorderedPair(Object first, Object second)
           
 
Method Summary
 boolean contains(Object object)
           
 boolean equals(Object object)
          To conform to the contracts for Set, List, and other potential types of Collections, instances of this class can only be .equals() to other instances of this class.
 Object getFirst()
           
 Object getSecond()
           
 int hashCode()
           
 boolean isEmpty()
           
 Iterator iterator()
           
 void setFirst(Object first)
           
 void setSecond(Object second)
           
 int size()
          This implementation counts the number of elements accessed by the Iterator.
 Object[] toArray()
           
 
Methods inherited from class com.phoenixst.collections.AbstractUnmodifiableCollection
addAll, clear, remove, removeAll, retainAll
 
Methods inherited from class java.util.AbstractCollection
add, containsAll, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnorderedPair

public UnorderedPair()

UnorderedPair

public UnorderedPair(Object first,
                     Object second)
Method Detail

getFirst

public Object getFirst()

setFirst

public void setFirst(Object first)

getSecond

public Object getSecond()

setSecond

public void setSecond(Object second)

size

public int size()
Description copied from class: AbstractUnmodifiableCollection
This implementation counts the number of elements accessed by the Iterator.

Specified by:
size in interface Collection
Overrides:
size in class AbstractUnmodifiableCollection

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection
Overrides:
isEmpty in class AbstractCollection

contains

public boolean contains(Object object)
Specified by:
contains in interface Collection
Overrides:
contains in class AbstractCollection

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in class AbstractCollection

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection
Overrides:
toArray in class AbstractCollection

equals

public boolean equals(Object object)
To conform to the contracts for Set, List, and other potential types of Collections, instances of this class can only be .equals() to other instances of this class.

Specified by:
equals in interface Collection
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection
Overrides:
hashCode in class Object

Plexus v0.13.1

See the Plexus project home, hosted by SourceForge.
Copyright ? 1994-2006, by Phoenix Software Technologists, Inc. and others. All Rights Reserved. Use is subject to license terms.