org.norther.tammi.acorn.util
Class UnmodifiableCollection

java.lang.Object
  extended by org.norther.tammi.acorn.util.UnmodifiableCollection
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection
Direct Known Subclasses:
CounterCollection, ModifiableCollection, UnmodifiableList, UnmodifiableSet

public class UnmodifiableCollection
extends Object
implements Collection, Cloneable, Serializable

An unmodifiable collection wrapper filtering out additions and removals.

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
UnmodifiableCollection()
          Constructs an empty collection.
UnmodifiableCollection(Collection c)
          Constructs a new collection.
 
Method Summary
 boolean add(Object o)
           
 boolean addAll(Collection c)
           
 void clear()
           
 Object clone()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection c)
           
 boolean equals(Object o)
           
protected  Collection getCollection()
          Gets the collection adaptee.
 int hashCode()
           
 boolean isEmpty()
           
 Iterator iterator()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection c)
           
 boolean retainAll(Collection c)
           
protected  void setCollection(Collection c)
          Sets the collection adaptee.
 int size()
           
 Object[] toArray()
           
 Object[] toArray(Object[] a)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnmodifiableCollection

public UnmodifiableCollection()
Constructs an empty collection.


UnmodifiableCollection

public UnmodifiableCollection(Collection c)
Constructs a new collection.

Parameters:
c - a collection to wrap.
Method Detail

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

clone

public Object clone()
Overrides:
clone in class Object

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

getCollection

protected Collection getCollection()
Gets the collection adaptee.

Returns:
the wrapped collection.

setCollection

protected void setCollection(Collection c)
Sets the collection adaptee.

Parameters:
c - the wrapped collection.


Copyright © 2004 The Norther Organization. All rights reserved.