public class SortedList extends LinkedList
| Constructor and Description |
|---|
SortedList()
Constructs an empty list with ascending order.
|
SortedList(boolean ascending)
Constructs an empty list with given order.
|
SortedList(Comparator comp,
boolean ascending)
Constructs an empty list with given order.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
Object element)
Inserts the specified element at the specified position in this list.
|
boolean |
add(Object o)
Appends the specified element to the end of this list.
|
boolean |
addAll(Collection c)
Appends all of the elements in the specified collection to the end of
this list, in the order that they are returned by the specified
collection's iterator.
|
boolean |
addAll(int index,
Collection c)
Inserts all of the elements in the specified collection into this
list, starting at the specified position.
|
void |
addFirst(Object o)
Inserts the given element at the beginning of this list.
|
void |
addLast(Object o)
Appends the given element to the end of this list.
|
int |
insertElement(int index,
Object obj)
Insert an element into the list.
|
clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, toArray, toArrayiteratorequals, hashCode, listIterator, subListcontainsAll, isEmpty, removeAll, retainAll, toStringcontainsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subListpublic SortedList()
public SortedList(boolean ascending)
ascending - True, if the list should sort ascending.public SortedList(Comparator comp, boolean ascending)
comp - A comparator to use for comparing elements.ascending - True, if the list shoudl sort ascending.public void addFirst(Object o)
addFirst in interface DequeaddFirst in class LinkedListo - the element to be inserted at the beginning of this list.public void addLast(Object o)
addLast in interface DequeaddLast in class LinkedListo - the element to be inserted at the end of this list.public boolean add(Object o)
add in interface Collectionadd in interface Dequeadd in interface Listadd in interface Queueadd in class LinkedListo - element to be appended to this list.public boolean addAll(Collection c)
addAll in interface CollectionaddAll in interface ListaddAll in class LinkedListc - the elements to be inserted into this list.NullPointerException - if the specified collection is null.public boolean addAll(int index,
Collection c)
addAll in interface ListaddAll in class LinkedListindex - index at which to insert first element
from the specified collection.c - elements to be inserted into this list.IndexOutOfBoundsException - if the specified index is out of
range (index < 0 || index > size()).NullPointerException - if the specified collection is null.public void add(int index,
Object element)
add in interface Listadd in class LinkedListindex - index at which the specified element is to be inserted.element - element to be inserted.IndexOutOfBoundsException - if the specified index is out of
range (index < 0 || index > size()).public int insertElement(int index,
Object obj)
index - The index where to start insertion.obj - The element to insert.Copyright © 2012. All Rights Reserved.