public class SortedList<T> extends LinkedList<T>
Constructor and Description |
---|
SortedList()
Constructs an empty list with ascending order.
|
SortedList(boolean ascending)
Constructs an empty list with given order.
|
SortedList(Comparator<? super T> comp,
boolean ascending)
Constructs an empty list with given order.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
T element)
Inserts the specified element at the specified position in this list.
|
boolean |
add(T o)
Appends the specified element to the end of this list.
|
boolean |
addAll(Collection<? extends T> 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<? extends T> c)
Inserts all of the elements in the specified collection into this
list, starting at the specified position.
|
void |
addFirst(T o)
Inserts the given element at the beginning of this list.
|
void |
addLast(T o)
Appends the given element to the end of this list.
|
int |
insertElement(int index,
T 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, toArray
iterator
equals, hashCode, listIterator, subList
containsAll, isEmpty, removeAll, retainAll, toString
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList
public SortedList()
public SortedList(boolean ascending)
ascending
- True, if the list should sort ascending.public SortedList(Comparator<? super T> comp, boolean ascending)
comp
- A comparator to use for comparing elements.ascending
- True, if the list shoudl sort ascending.public void addFirst(T o)
public void addLast(T o)
public boolean add(T o)
add
in interface Collection<T>
add
in interface Deque<T>
add
in interface List<T>
add
in interface Queue<T>
add
in class LinkedList<T>
o
- element to be appended to this list.public boolean addAll(Collection<? extends T> c)
addAll
in interface Collection<T>
addAll
in interface List<T>
addAll
in class LinkedList<T>
c
- the elements to be inserted into this list.NullPointerException
- if the specified collection is null.public boolean addAll(int index, Collection<? extends T> c)
addAll
in interface List<T>
addAll
in class LinkedList<T>
index
- 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, T element)
add
in interface List<T>
add
in class LinkedList<T>
index
- 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, T obj)
index
- The index where to start insertion.obj
- The element to insert.Copyright © 2013. All Rights Reserved.