E - The type of element managed by the collection.public class List<E> extends SortableCollection<E> implements Indexed<E>
| Constructor and Description |
|---|
List()
This constructor creates a new empty list.
|
List(Collection<? extends E> elements)
This constructor creates a new list using the elements provided in a collection.
|
List(java.util.Collection<? extends E> elements)
This constructor creates a new list using the elements provided in a java collection.
|
List(E[] elements)
This constructor creates a new list using the elements provided in an array.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addElement(E element)
This method adds a new element to the collection.
|
static <E> List<E> |
concatenate(List<E> list1,
List<E> list2)
This function returns a new list that contains the all the elements from
both the specified lists.
|
List<E> |
copy() |
Iterator<E> |
createDefaultIterator()
This method creates a new default iterator for the collection.
|
Manipulator<E> |
createDefaultManipulator()
This method creates a new default manipulator for the collection.
|
E |
getElementAtIndex(int index)
This method returns the element at the specified index.
|
List<E> |
getElementsInRange(int firstIndex,
int lastIndex)
This method returns a collection of the elements in the specified index range.
|
int |
getIndexOfElement(E element)
This method return the index of the specified element, or zero if the element
is not found.
|
int |
getNumberOfElements() |
void |
insertElementBeforeIndex(E element,
int index)
This method inserts the specified element into the collection before the element
associated with the specified index.
|
void |
insertElementsBeforeIndex(java.lang.Iterable<? extends E> elements,
int index)
This method inserts the specified elements into the collection before the element
associated with the specified index.
|
void |
removeAllElements()
This method removes all elements from the collection.
|
boolean |
removeElement(E element)
This method removes the specified element from the collection.
|
E |
removeElementAtIndex(int index)
This method removes from the collection the element associated with the specified
index.
|
List<E> |
removeElementsInRange(int firstIndex,
int lastIndex)
This method removes from the collection the elements associated with the specified
index range.
|
E |
replaceElementAtIndex(E element,
int index)
This method replaces an existing element in the collection with a new one.
|
E[] |
toArray() |
concatenate, shuffleElements, sortElements, sortElements, sortElementsaddElements, addElements, removeElements, removeElementscompareTo, containsAllElementsIn, containsAnyElementsIn, containsElement, equals, hashCode, isEmpty, iterator, normalizedIndexaddSerializableClass, addSerializableClass, toExposedString, toString, toStringpublic List()
public List(E[] elements)
elements - The elements that should be used to seed the list.public List(Collection<? extends E> elements)
elements - The elements that should be used to seed the list.public List(java.util.Collection<? extends E> elements)
elements - The elements that should be used to seed the list.public E[] toArray()
toArray in interface Sequential<E>toArray in class Collection<E>public List<E> copy()
copy in class craterdog.smart.SmartObject<Collection<E>>public final int getNumberOfElements()
getNumberOfElements in interface Sequential<E>public Iterator<E> createDefaultIterator()
AccessiblecreateDefaultIterator in interface Accessible<E>public final E getElementAtIndex(int index)
IndexedgetElementAtIndex in interface Accessible<E>getElementAtIndex in interface Indexed<E>index - The index of the element to be returned.public final int getIndexOfElement(E element)
IndexedgetIndexOfElement in interface Accessible<E>getIndexOfElement in interface Indexed<E>element - The element to be checked for in the collection.public final List<E> getElementsInRange(int firstIndex, int lastIndex)
IndexedgetElementsInRange in interface Accessible<E>getElementsInRange in interface Indexed<E>firstIndex - The index of the first element to be returned.lastIndex - the index of the last element to be returned.public final boolean addElement(E element)
DynamicaddElement in interface Dynamic<E>element - The new element to be added.public final boolean removeElement(E element)
DynamicremoveElement in interface Dynamic<E>element - The element to be removed.public final void removeAllElements()
AccessibleremoveAllElements in interface Accessible<E>public final void insertElementBeforeIndex(E element, int index)
IndexedinsertElementBeforeIndex in interface Indexed<E>element - The new element to be inserted into the collection.index - The index of the element before which the new element is to be inserted.public final void insertElementsBeforeIndex(java.lang.Iterable<? extends E> elements, int index)
IndexedinsertElementsBeforeIndex in interface Indexed<E>elements - The new elements to be inserted into the collection.index - The index of the element before which the new element is to be inserted.public final E replaceElementAtIndex(E element, int index)
IndexedreplaceElementAtIndex in interface Indexed<E>element - The new element that will replace the existing one.index - The index of the existing element.public final E removeElementAtIndex(int index)
IndexedremoveElementAtIndex in interface Indexed<E>index - The index of the element to be removed.public final List<E> removeElementsInRange(int firstIndex, int lastIndex)
IndexedremoveElementsInRange in interface Indexed<E>firstIndex - The index of the first element to be removed.lastIndex - The index of the last element to be removed.public Manipulator<E> createDefaultManipulator()
SortablecreateDefaultManipulator in interface Sortable<E>public static <E> List<E> concatenate(List<E> list1, List<E> list2)
E - The type of element contained in the lists.list1 - The first list whose elements are to be added.list2 - The second list whose elements are to be added.Copyright © 2015 Crater Dog Technologies(TM). All rights reserved.