net.walend.collection
Interface MutableCollection

All Superinterfaces:
Collection, HasState
All Known Subinterfaces:
FreezableSet, MutableCollectionOfFreezables, MutableList, MutableSet, MutableSetOfFreezables
All Known Implementing Classes:
DelegatingMutableSet, FreezableDelegatingMutableSet, JDBCBackedMutableSet, MemSet, MutableArrayList, MutableFreezerHashSet, MutableHashSet, MutableHashSetOfFreezables

public interface MutableCollection
extends Collection

Use this interface for changable Collections of Objects.

Use a direct implementation of this interface, like Bag, to handle a multiset.

All implementations of javasupport.collection.MutableCollection should include four standard constructors: a no-argument constructor, a constructor with an initial size, a constructor with the single argument Collection (or a sub interface) which creates a copy of the argument, and a constructor with the single argument java.util.Collection.

MutableCollection implementations should not mess with the normal java equals() and hashCode() methods. Doing so prevents creating a Map of dynamic Sets.

Since:
20010216
Author:
David Walend

Method Summary
 boolean add(java.lang.Object object)
          Adds a Object to the MutableCollection.
 boolean addAll(Collection c)
          Adds all the Objects in c to this MutableCollection by using the add() method.
 void clear()
          Removes all of the Objects in this collection.
 boolean remove(java.lang.Object object)
          Removes a Object from the MutableCollection.
 boolean removeAll(Collection c)
          Removes all the Objects in c from this MutableCollection by using the remove() method.
 boolean retainAll(Collection c)
          Retains only the Objects in this collection that are contained in c by using the contains() and remove() methods.
 
Methods inherited from interface net.walend.collection.Collection
contains, containsAll, getIdentitor, getJavaCollection, isEmpty, iterator, sameContentsAs, size
 
Methods inherited from interface net.walend.collection.HasState
getPrincipleInterface, sameStateAs
 

Method Detail

add

public boolean add(java.lang.Object object)
Adds a Object to the MutableCollection. Sets will only add it to the Set if it's not already there.

Returns:
true if the MutableCollection changes, false if not.

remove

public boolean remove(java.lang.Object object)
Removes a Object from the MutableCollection.

Returns:
true if the MutableCollection changes, false if not.

addAll

public boolean addAll(Collection c)
Adds all the Objects in c to this MutableCollection by using the add() method. Returns true if this MutableCollection changes.


removeAll

public boolean removeAll(Collection c)
Removes all the Objects in c from this MutableCollection by using the remove() method. Returns true if this Colleciton changes.


retainAll

public boolean retainAll(Collection c)
Retains only the Objects in this collection that are contained in c by using the contains() and remove() methods. Returns true if this Colleciton changes.


clear

public void clear()
Removes all of the Objects in this collection.



Copyright (c) 2000, 2001, David Walend