org.norther.tammi.acorn.util
Class ModifiableList

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

public class ModifiableList
extends UnmodifiableList

Extends UnmodifiableList by supporting modifications after cloning.

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
ModifiableList(boolean modifiable)
          Constructs an empty list.
ModifiableList(Collection c, boolean modifiable)
          Constructs a new list.
ModifiableList(List l, boolean modifiable)
          Constructs a new list.
ModifiableList(Object[] a, boolean modifiable)
          Constructs a new list for an array.
 
Method Summary
 void add(int index, Object o)
           
 boolean addAll(int index, Collection c)
           
 Object clone()
           
 ListIterator listIterator()
           
 ListIterator listIterator(int index)
           
 Object remove(int index)
           
 Object set(int index, Object o)
           
protected  void setCollection(Collection c)
          Sets the collection adaptee.
 List subList(int fromIndex, int toIndex)
           
 
Methods inherited from class org.norther.tammi.acorn.util.UnmodifiableList
get, getList, indexOf, lastIndexOf, setList
 
Methods inherited from class org.norther.tammi.acorn.util.UnmodifiableCollection
add, addAll, clear, contains, containsAll, equals, getCollection, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

ModifiableList

public ModifiableList(boolean modifiable)
Constructs an empty list.

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

ModifiableList

public ModifiableList(List l,
                      boolean modifiable)
Constructs a new list.

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

ModifiableList

public ModifiableList(Collection c,
                      boolean modifiable)
Constructs a new list.

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

ModifiableList

public ModifiableList(Object[] a,
                      boolean modifiable)
Constructs a new list for an array.

Parameters:
a - an array 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 void add(int index,
                Object o)
Specified by:
add in interface List
Overrides:
add in class UnmodifiableList

addAll

public boolean addAll(int index,
                      Collection c)
Specified by:
addAll in interface List
Overrides:
addAll in class UnmodifiableList

listIterator

public ListIterator listIterator()
Specified by:
listIterator in interface List
Overrides:
listIterator in class UnmodifiableList

listIterator

public ListIterator listIterator(int index)
Specified by:
listIterator in interface List
Overrides:
listIterator in class UnmodifiableList

remove

public Object remove(int index)
Specified by:
remove in interface List
Overrides:
remove in class UnmodifiableList

set

public Object set(int index,
                  Object o)
Specified by:
set in interface List
Overrides:
set in class UnmodifiableList

subList

public List subList(int fromIndex,
                    int toIndex)
Specified by:
subList in interface List
Overrides:
subList in class UnmodifiableList

setCollection

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

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


Copyright © 2004 The Norther Organization. All rights reserved.