weiss.util
Class AbstractCollection

java.lang.Object
  |
  +--weiss.util.AbstractCollection
All Implemented Interfaces:
Collection, java.io.Serializable
Direct Known Subclasses:
ArrayList, HashSet, LinkedList, TreeSet

public abstract class AbstractCollection
extends java.lang.Object
implements Collection

AbstractCollection provides default implementations for some of the easy methods in the Collection interface.

See Also:
Serialized Form

Constructor Summary
AbstractCollection()
           
 
Method Summary
 void clear()
          Change the size of this collection to zero.
 boolean contains(java.lang.Object x)
          Returns true if this collection contains x.
 boolean equals(java.lang.Object other)
          Return true if items in other collection are equal to items in this collection (same order, and same according to equals).
 int hashCode()
          Return the hashCode.
 boolean isEmpty()
          Tests if this collection is empty.
 boolean remove(java.lang.Object x)
          Removes non-null x from this collection.
 java.lang.Object[] toArray()
          Obtains a primitive array view of the collection.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface weiss.util.Collection
add, iterator, size
 

Constructor Detail

AbstractCollection

public AbstractCollection()
Method Detail

isEmpty

public boolean isEmpty()
Tests if this collection is empty.
Specified by:
isEmpty in interface Collection
Returns:
true if the size of this collection is zero.

clear

public void clear()
Change the size of this collection to zero.
Specified by:
clear in interface Collection

toArray

public java.lang.Object[] toArray()
Obtains a primitive array view of the collection.
Specified by:
toArray in interface Collection

contains

public boolean contains(java.lang.Object x)
Returns true if this collection contains x. If x is null, returns false. (This behavior may not always be appropriate.)
Specified by:
contains in interface Collection
Parameters:
x - the item to search for.

remove

public boolean remove(java.lang.Object x)
Removes non-null x from this collection. (This behavior may not always be appropriate.)
Specified by:
remove in interface Collection
Parameters:
x - the item to remove.

equals

public final boolean equals(java.lang.Object other)
Return true if items in other collection are equal to items in this collection (same order, and same according to equals).
Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()
Return the hashCode.
Overrides:
hashCode in class java.lang.Object