AbstractCollection

This class provides a skeletal implementation of the {@code Collection} interface, to minimize the effort required to implement this interface. <p>

To implement an unmodifiable collection, the programmer needs only to extend this class and provide implementations for the {@code iterator} and {@code size} methods. (The iterator returned by the {@code iterator} method must implement {@code hasNext} and {@code next}.)<p>

To implement a modifiable collection, the programmer must additionally override this class's {@code add} method (which otherwise throws an {@code UnsupportedOperationException}), and the iterator returned by the {@code iterator} method must additionally implement its {@code remove} method.<p>

The programmer should generally provide a void (no argument) and {@code Collection} constructor, as per the recommendation in the {@code Collection} interface specification.<p>

The documentation for each non-abstract method in this class describes its implementation in detail. Each of these methods may be overridden if the collection being implemented admits a more efficient implementation.<p>

This class is a member of the <a href="{@docRoot}/java/util/package-summary.html#CollectionsFramework"> Java Collections Framework</a>.

@author Josh Bloch @author Neal Gafter @see Collection

Constructors

this
this()

Sole constructor. (For invocation by subclass constructors, typically implicit.)

Members

Functions

add
bool add(E e)
Undocumented in source. Be warned that the author may not have intended to support it.
addAll
bool addAll(Collection!E c)

{@inheritDoc}

addAll
bool addAll(E[] c)
Undocumented in source. Be warned that the author may not have intended to support it.
clear
void clear()
Undocumented in source. Be warned that the author may not have intended to support it.
contains
bool contains(E o)

{@inheritDoc}

containsAll
bool containsAll(Collection!E c)

{@inheritDoc}

isEmpty
bool isEmpty()

{@inheritDoc}

iterator
InputRange!E iterator()

Returns an iterator over the elements contained in this collection.

opApply
int opApply(int delegate(ref E) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(IObject o)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Object o)
Undocumented in source. Be warned that the author may not have intended to support it.
remove
bool remove(E e)
Undocumented in source. Be warned that the author may not have intended to support it.
removeAll
bool removeAll(Collection!E c)

{@inheritDoc}

removeIf
bool removeIf(Predicate!E filter)
Undocumented in source. Be warned that the author may not have intended to support it.
retainAll
bool retainAll(Collection!E c)

{@inheritDoc}

size
int size()
Undocumented in source.
toArray
E[] toArray()

{@inheritDoc}

toHash
size_t toHash()
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString()

Returns a string representation of this collection. The string representation consists of a list of the collection's elements in the order they are returned by its iterator, enclosed in square brackets ({@code "[]"}). Adjacent elements are separated by the characters {@code ", "} (comma and space). Elements are converted to strings as by {@link string#valueOf(Object)}.

Meta