-
Notifications
You must be signed in to change notification settings - Fork 8
Java Collection Abstractions
The Java Collection Framework itself is implemented using a set of abstract classes that implement the interfaces defined above. For a more detailed view of the model below, click here.
This abstract class provides default implementations for many of the methods defined in the Accessible<E>
interface. Concrete subclasses may override some of these methods with implementation specific methods that are optimized for the particular implementation. This abstract class implements the following methods:
java.lang.String toString()
java.lang.String toString(java.lang.String indentation)
int hashCode()
boolean equals(Object object)
int compareTo(Collection<E> collection)
boolean isEmpty()
boolean containsElement(E element)
boolean containsAll(java.lang.Iterable<? extends E> collection)
boolean containsAny(java.lang.Iterable<? extends E> collection)
E[] toArray()
This abstract class extends the default implementations provided by the Collection<E>
abstract class by providing additional attributes and methods that are useful for collections that do not allow their structure to be directly manipulated. This abstract class implements the following methods:
Iterator<E> createIterator()
int getSize()
int getIndex(E element)
E getElement(int index)
Collection<E> getElements(int firstIndex, int lastIndex)
void removeAll()
This abstract class extends the default implementations provided by the Collection<E>
abstract class by providing additional attributes and methods that are useful for collections that allow their structure to be directly manipulated by implementing the Dynamic<E>
interface. This abstract class implements the following methods:
int addElements(E[] elements)
int addElements(Iterable<? extends E> elements)
int removeElements(E[] elements)
int removeElements(Iterable<? extends E> elements)
This abstract class extends the default implementations provided by the OpenCollection<E>
abstract class by providing additional implementations for many of the methods defined in the Ordered<E>
interface. Again, concrete subclasses may override some of these methods with implementation specific methods that are optimized for the particular implementation. This abstract class implements the following methods:
Iterator<E> createIterator()
int getSize()
int getIndex(E element)
E getElement(int index)
Collection<E> getElements(int firstIndex, int lastIndex)
boolean addElement(E element)
boolean removeElement(E element)
void removeAll()
java.util.Comparator<? super E> getComparator()
This abstract class also extends the default implementations provided by the OpenCollection<E>
abstract class by providing additional implementations for many of the methods defined in the Sortable<E>
interface. As above, concrete subclasses may override some of these methods with implementation specific methods that are optimized for the particular implementation. This abstract class implements the following methods:
void shuffleElements()
void sortElements()
void sortElements(java.util.Comparator<? super E> comparator)
void sortElements(Sorter<E> sorter, java.util.Comparator<? super E> comparator)
It also implements these (static) functions:
static SortableCollection<E> concatenate(SortableCollection<E> collection1, SortableCollection<E> collection2)
This abstract class defines a framework for each concrete sorter class that sorts the elements in a collection using a specific algorithm and comparator function. It defines the following methods which must be implemented by each concrete subclass:
void sortCollection(SortableCollection<E> collection)
void sortCollection(SortableCollection<E> collection, java.util.Comparator<? super E> comparator)
This abstract class extends the java.util.Iterator<E>
interface and defines a framework for each concrete iterator class that allows the iteration over a collection's elements. The iterator points at the slots on either side of the elements in the collection:
[element 1] [element 2] [element 3] ... [element N]
^ ^ ^ ^ ^ ^
at start at end
This abstract class defines the following methods which must be implemented by each concrete subclass:
void toStart()
void toIndex(int index)
void toEnd()
boolean hasPrevious()
E getPrevious()
boolean hasNext()
E getNext()
This abstract class extends the framework provided by the Iterator<E>
abstract class by providing additional method definitions which must be implemented by each concrete subclass. As with the iterator, the manipulator points at the slots on either side of the elements in the collection:
[element 1] [element 2] [element 3] ... [element N]
^ ^ ^ ^ ^ ^
at start at end
However, the manipulator defines the following additional methods which can be used to manipulate the elements in the collection:
void insertElement(E element)
E removeNext()
E removePrevious()
Copyright © 2009 - 2022 Crater Dog Technologies™. All rights reserved.