weiss.util
Interface Collection<AnyType>

All Superinterfaces:
java.lang.Iterable<AnyType>, java.io.Serializable
All Known Subinterfaces:
List<AnyType>, Queue<AnyType>, Set<AnyType>, SortedSet<AnyType>
All Known Implementing Classes:
AbstractCollection, ArrayList, HashSet, LinkedList, PriorityQueue, TreeSet

public interface Collection<AnyType>
extends java.lang.Iterable<AnyType>, java.io.Serializable

Collection interface; the root of all 1.5 collections.


Method Summary
 boolean add(AnyType x)
          Adds an item to this collection.
 void clear()
          Change the size of this collection to zero.
 boolean contains(java.lang.Object x)
          Tests if some item is in this collection.
 boolean isEmpty()
          Tests if this collection is empty.
 Iterator<AnyType> iterator()
          Obtains an Iterator object used to traverse the collection.
 boolean remove(java.lang.Object x)
          Removes an item from this collection.
 int size()
          Returns the number of items in this collection.
 java.lang.Object[] toArray()
          Obtains a primitive array view of the collection.
<OtherType>
OtherType[]
toArray(OtherType[] arr)
          Obtains a primitive array view of the collection.
 

Method Detail

size

int size()
Returns the number of items in this collection.

Returns:
the number of items in this collection.

isEmpty

boolean isEmpty()
Tests if this collection is empty.

Returns:
true if the size of this collection is zero.

contains

boolean contains(java.lang.Object x)
Tests if some item is in this collection.

Parameters:
x - any object.
Returns:
true if this collection contains an item equal to x.

add

boolean add(AnyType x)
Adds an item to this collection.

Parameters:
x - any object.
Returns:
true if this item was added to the collection.

remove

boolean remove(java.lang.Object x)
Removes an item from this collection.

Parameters:
x - any object.
Returns:
true if this item was removed from the collection.

clear

void clear()
Change the size of this collection to zero.


iterator

Iterator<AnyType> iterator()
Obtains an Iterator object used to traverse the collection.

Specified by:
iterator in interface java.lang.Iterable<AnyType>
Returns:
an iterator positioned prior to the first element.

toArray

java.lang.Object[] toArray()
Obtains a primitive array view of the collection.

Returns:
the primitive array view.

toArray

<OtherType> OtherType[] toArray(OtherType[] arr)
Obtains a primitive array view of the collection.

Returns:
the primitive array view.