org.norther.tammi.acorn.util
Class UnmodifiableCollection<E>

java.lang.Object
  extended by org.norther.tammi.acorn.util.UnmodifiableCollection<E>
Type Parameters:
E - the element type.
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>
Direct Known Subclasses:
CounterCollection, ModifiableCollection, UnmodifiableList, UnmodifiableSet

public class UnmodifiableCollection<E>
extends Object
implements Collection<E>, Cloneable, Serializable

An unmodifiable collection wrapper filtering out additions and removals.

Version:
$Id: UnmodifiableCollection.java,v 1.13 2009/10/29 21:44:08 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
UnmodifiableCollection()
          Constructs an empty collection.
UnmodifiableCollection(Collection<? extends E> c)
          Constructs a new collection.
 
Method Summary
 boolean add(E o)
           
 boolean addAll(Collection<? extends E> c)
           
 void clear()
           
 Object clone()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> c)
           
 boolean equals(Object o)
           
protected  Collection<E> getCollection()
          Gets the collection adaptee.
 int hashCode()
           
 boolean isEmpty()
           
 Iterator<E> iterator()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
protected  void setCollection(Collection<E> c)
          Sets the collection adaptee.
 int size()
           
 Object[] toArray()
           
<T> T[]
toArray(T[] 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<? extends E> 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<E>
Overrides:
equals in class Object

hashCode

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

clone

public Object clone()
Overrides:
clone in class Object

add

public boolean add(E o)
Specified by:
add in interface Collection<E>

addAll

public boolean addAll(Collection<? extends E> c)
Specified by:
addAll in interface Collection<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>

contains

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

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E>

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>

remove

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

removeAll

public boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<E>

retainAll

public boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<E>

size

public int size()
Specified by:
size in interface Collection<E>

toArray

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

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface Collection<E>

toString

public String toString()
Overrides:
toString in class Object

getCollection

protected Collection<E> getCollection()
Gets the collection adaptee.

Returns:
the wrapped collection.

setCollection

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

Parameters:
c - the wrapped collection.


Copyright © 2004 The Norther Organization. All rights reserved.