Package util
Class SortedLinkedList<T extends Comparable<T>>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.AbstractSequentialList<E>
-
- java.util.LinkedList<T>
-
- util.SortedLinkedList<T>
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<T>
,Collection<T>
,Deque<T>
,List<T>
,Queue<T>
public class SortedLinkedList<T extends Comparable<T>> extends LinkedList<T>
ALinkedList
ofComparable
elements that is sorted according to the natural ordering of its elements- Author:
- Christoph Schimeczek
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description SortedLinkedList()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int i, T t)
Not supported bySortedLinkedList
, useadd(Comparable)
insteadboolean
add(T item)
insert an item - the item will be placed at the correct position in the listvoid
addFirst(T t)
Not supported bySortedLinkedList
, useadd(Comparable)
insteadvoid
addLast(T t)
Not supported bySortedLinkedList
, useadd(Comparable)
insteadboolean
offer(T t)
Not supported bySortedLinkedList
, useadd(Comparable)
insteadboolean
offerFirst(T t)
Not supported bySortedLinkedList
, useadd(Comparable)
insteadboolean
offerLast(T t)
Not supported bySortedLinkedList
, useadd(Comparable)
insteadT
set(int i, T t)
void
sort(Comparator<? super T> c)
Not supported bySortedLinkedList
, order is fixed to natural order-
Methods inherited from class java.util.LinkedList
addAll, addAll, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, size, spliterator, toArray, toArray
-
Methods inherited from class java.util.AbstractSequentialList
iterator
-
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, replaceAll, retainAll, subList
-
-
-
-
Method Detail
-
add
public boolean add(T item)
insert an item - the item will be placed at the correct position in the list- Specified by:
add
in interfaceCollection<T extends Comparable<T>>
- Specified by:
add
in interfaceDeque<T extends Comparable<T>>
- Specified by:
add
in interfaceList<T extends Comparable<T>>
- Specified by:
add
in interfaceQueue<T extends Comparable<T>>
- Overrides:
add
in classLinkedList<T extends Comparable<T>>
- Returns:
- true, as required by
LinkedList
-
add
public void add(int i, T t)
Not supported bySortedLinkedList
, useadd(Comparable)
instead- Specified by:
add
in interfaceList<T extends Comparable<T>>
- Overrides:
add
in classLinkedList<T extends Comparable<T>>
-
addFirst
public void addFirst(T t)
Not supported bySortedLinkedList
, useadd(Comparable)
instead- Specified by:
addFirst
in interfaceDeque<T extends Comparable<T>>
- Overrides:
addFirst
in classLinkedList<T extends Comparable<T>>
-
addLast
public void addLast(T t)
Not supported bySortedLinkedList
, useadd(Comparable)
instead- Specified by:
addLast
in interfaceDeque<T extends Comparable<T>>
- Overrides:
addLast
in classLinkedList<T extends Comparable<T>>
-
offer
public boolean offer(T t)
Not supported bySortedLinkedList
, useadd(Comparable)
instead- Specified by:
offer
in interfaceDeque<T extends Comparable<T>>
- Specified by:
offer
in interfaceQueue<T extends Comparable<T>>
- Overrides:
offer
in classLinkedList<T extends Comparable<T>>
-
offerFirst
public boolean offerFirst(T t)
Not supported bySortedLinkedList
, useadd(Comparable)
instead- Specified by:
offerFirst
in interfaceDeque<T extends Comparable<T>>
- Overrides:
offerFirst
in classLinkedList<T extends Comparable<T>>
-
offerLast
public boolean offerLast(T t)
Not supported bySortedLinkedList
, useadd(Comparable)
instead- Specified by:
offerLast
in interfaceDeque<T extends Comparable<T>>
- Overrides:
offerLast
in classLinkedList<T extends Comparable<T>>
-
set
public T set(int i, T t)
- Specified by:
set
in interfaceList<T extends Comparable<T>>
- Overrides:
set
in classLinkedList<T extends Comparable<T>>
-
sort
public void sort(Comparator<? super T> c)
Not supported bySortedLinkedList
, order is fixed to natural order
-
-