AbstractCollection
Keywords: weiss.util.AbstractCollection class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weiss.util
Class AbstractCollection<AnyType>

    java.lang.Object
      weiss.util.AbstractCollection<AnyType>

All Implemented Interfaces:
  java.io.Serializable, java.lang.Iterable<AnyType>, Collection<AnyType>

Direct Known Subclasses:
  ArrayList, HashSet, LinkedList, PriorityQueue, TreeSet

    public abstract class AbstractCollection<AnyType>

extends java.lang.Object
implements Collection<AnyType>

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

See Also:
  Serialized Form

Constructor Summary
`AbstractCollection()`

Method Summary
`boolean` | `add(AnyType x)` Adds x to this collections.
`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.
`
`<OtherType> OtherType[]`
` | `toArray(OtherType[] arr)` Obtains a primitive array view of the collection.
`java.lang.String` | `toString()` Return a string representation of this collection.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface weiss.util.Collection
`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<AnyType>`
  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<AnyType>`

### toArray

    public java.lang.Object[] toArray()

  Obtains a primitive array view of the collection.

  Specified by:
    `toArray` in interface `Collection<AnyType>`
  Returns:
    the primitive array view.

### toArray

    public <OtherType> OtherType[] toArray(OtherType[] arr)

  Description copied from interface: `Collection`
  Obtains a primitive array view of the collection.

  Specified by:
    `toArray` in interface `Collection<AnyType>`
  Returns:
    the primitive array view.

### 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<AnyType>`
  Parameters:
    `x` - the item to search for.
  Returns:
    true if x is not null and is found in this collection.

### add

    public boolean add(AnyType x)

  Adds x to this collections. This default implementation always throws an exception.

  Specified by:
    `add` in interface `Collection<AnyType>`
  Parameters:
    `x` - the item to add.
  Returns:
    true if this item was added to the collection.
  Throws:
    `java.lang.UnsupportedOperationException` - always.

### 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<AnyType>`
  Parameters:
    `x` - the item to remove.
  Returns:
    true if remove succeeds.

### 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`

### toString

    public java.lang.String toString()

  Return a string representation of this collection.

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD