org.norther.tammi.acorn.util
Class ModifiableCollection

java.lang.Object
  extended by org.norther.tammi.acorn.util.UnmodifiableCollection
      extended by org.norther.tammi.acorn.util.ModifiableCollection
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection

public class ModifiableCollection
extends UnmodifiableCollection

Extends UnmodifiableCollection by supporting modifications after cloning.

Author:
Ilkka Priha
See Also:
Serialized Form

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

Constructor Detail

ModifiableCollection

public ModifiableCollection(boolean modifiable)
Constructs an empty collection.

Parameters:
modifiable - true to clone automatically during modifications, false to allow modifications only after cloning.

ModifiableCollection

public ModifiableCollection(Collection c,
                            boolean modifiable)
Constructs a new collection.

Parameters:
c - a collection to wrap.
modifiable - true to clone automatically during modifications, false to allow modifications only after cloning.
Method Detail

clone

public Object clone()
Overrides:
clone in class UnmodifiableCollection

add

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

addAll

public boolean addAll(Collection x)
Specified by:
addAll in interface Collection
Overrides:
addAll in class UnmodifiableCollection

clear

public void clear()
Specified by:
clear in interface Collection
Overrides:
clear in class UnmodifiableCollection

iterator

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

remove

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

removeAll

public boolean removeAll(Collection x)
Specified by:
removeAll in interface Collection
Overrides:
removeAll in class UnmodifiableCollection

retainAll

public boolean retainAll(Collection x)
Specified by:
retainAll in interface Collection
Overrides:
retainAll in class UnmodifiableCollection

setCollection

protected void setCollection(Collection c)
Description copied from class: UnmodifiableCollection
Sets the collection adaptee.

Overrides:
setCollection in class UnmodifiableCollection
Parameters:
c - the wrapped collection.


Copyright © 2004 The Norther Organization. All rights reserved.