harpoon.Util.Collections
Class CollectionWrapper

java.lang.Object
  |
  +--harpoon.Util.Collections.CollectionWrapper
All Implemented Interfaces:
Collection
Direct Known Subclasses:
ListWrapper, SetWrapper

public class CollectionWrapper
extends Object
implements Collection

CollectionWrapper is a class that acts as a wrapper around another Collection, using it as its backing store. This class isn't meant for direct usage, but rather provides for an easy way for developers to quickly add extra independent behavior to their own specific Collections without having to reimplement all of AbstractCollection's interface

Version:
$Id: CollectionWrapper.java,v 1.2 2002/02/25 21:09:04 cananian Exp $
Author:
Felix S. Klock II <pnkfelix@mit.edu>

Field Summary
protected  Collection b
          Collection backing this.
 
Constructor Summary
CollectionWrapper(Collection c)
          Creates a CollectionWrapper.
 
Method Summary
 boolean add(Object o)
           
 boolean addAll(Collection c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection c)
           
 boolean equals(Object o)
           
 int hashCode()
           
 boolean isEmpty()
           
 Iterator iterator()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection c)
           
 boolean retainAll(Collection c)
           
 int size()
           
 Object[] toArray()
           
 Object[] toArray(Object[] a)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

b

protected final Collection b
Collection backing this.

Constructor Detail

CollectionWrapper

public CollectionWrapper(Collection c)
Creates a CollectionWrapper.

Method Detail

add

public boolean add(Object o)
Specified by:
add in interface Collection

addAll

public boolean addAll(Collection c)
Specified by:
addAll in interface Collection

clear

public void clear()
Specified by:
clear in interface Collection

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection

containsAll

public boolean containsAll(Collection c)
Specified by:
containsAll in interface Collection

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection

iterator

public Iterator iterator()
Specified by:
iterator in interface Collection

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection

removeAll

public boolean removeAll(Collection c)
Specified by:
removeAll in interface Collection

retainAll

public boolean retainAll(Collection c)
Specified by:
retainAll in interface Collection

size

public int size()
Specified by:
size in interface Collection

toArray

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

toArray

public Object[] toArray(Object[] a)
Specified by:
toArray in interface Collection

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
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