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, 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 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 Deque
addFirst
in class LinkedList
o
- the element to be inserted at the beginning of this list.public void addLast(Object o)
addLast
in interface Deque
addLast
in class LinkedList
o
- the element to be inserted at the end of this list.public boolean add(Object o)
add
in interface Collection
add
in interface Deque
add
in interface List
add
in interface Queue
add
in class LinkedList
o
- element to be appended to this list.public boolean addAll(Collection c)
addAll
in interface Collection
addAll
in interface List
addAll
in class LinkedList
c
- 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 List
addAll
in class LinkedList
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, Object element)
add
in interface List
add
in class LinkedList
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, Object obj)
index
- The index where to start insertion.obj
- The element to insert.Copyright © 2012. All Rights Reserved.