public class EmptyChain<T> extends Object implements Chain<T>
| Constructor and Description |
|---|
EmptyChain() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(Object e) |
boolean |
addAll(Collection<? extends T> c) |
void |
addFirst(T u)
Adds the given object at the beginning of the Chain.
|
void |
addLast(T u)
Adds the given object at the end of the Chain.
|
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
follows(T someObject,
T someReferenceObject)
Returns true if object
someObject follows object someReferenceObject in the Chain,
i.e. |
Collection<T> |
getElementsUnsorted()
Gets all elements in the chain.
|
T |
getFirst()
Returns the first object in this Chain.
|
T |
getLast()
Returns the last object in this Chain.
|
long |
getModificationCount()
Returns the number of times this chain has been modified.
|
T |
getPredOf(T point)
Returns the object immediately preceding
point. |
T |
getSuccOf(T point)
Returns the object immediately following
point. |
void |
insertAfter(Chain<T> toInsert,
T point)
Inserts
toInsert in the Chain after point. |
void |
insertAfter(Collection<? extends T> toInsert,
T point)
Inserts
toInsert in the Chain after point. |
void |
insertAfter(List<T> toInsert,
T point)
Inserts
toInsert in the Chain after point. |
void |
insertAfter(T toInsert,
T point)
Inserts
toInsert in the Chain after point. |
void |
insertBefore(Chain<T> toInsert,
T point)
Inserts
toInsert in the Chain before point. |
void |
insertBefore(Collection<? extends T> toInsert,
T point)
Inserts
toInsert in the Chain before point. |
void |
insertBefore(List<T> toInsert,
T point)
Inserts
toInsert in the Chain before point. |
void |
insertBefore(T toInsert,
T point)
Inserts
toInsert in the Chain before point. |
boolean |
isEmpty() |
Iterator<T> |
iterator()
Returns an iterator over this Chain.
|
Iterator<T> |
iterator(Object u)
Returns an iterator over this Chain, starting at the given object.
|
Iterator<T> |
iterator(Object head,
Object tail)
Returns an iterator over this Chain, starting at head and reaching tail (inclusive).
|
boolean |
remove(Object u)
Removes the given object from this Chain.
|
boolean |
removeAll(Collection<?> c) |
void |
removeFirst()
Removes the first object contained in this Chain.
|
void |
removeLast()
Removes the last object contained in this Chain.
|
boolean |
retainAll(Collection<?> c) |
int |
size()
Returns the size of this Chain.
|
Iterator<T> |
snapshotIterator()
Returns an iterator over a copy of this chain.
|
void |
swapWith(T out,
T in)
Replaces
out in the Chain by in. |
Object[] |
toArray() |
Object[] |
toArray(Object[] a) |
static <T> EmptyChain<T> |
v() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequals, hashCode, parallelStream, removeIf, spliterator, streampublic static <T> EmptyChain<T> v()
public boolean isEmpty()
isEmpty in interface Collection<T>public boolean contains(Object o)
contains in interface Collection<T>public Object[] toArray()
toArray in interface Collection<T>public Object[] toArray(Object[] a)
toArray in interface Collection<T>public boolean add(Object e)
add in interface Collection<T>public boolean containsAll(Collection<?> c)
containsAll in interface Collection<T>public boolean addAll(Collection<? extends T> c)
addAll in interface Collection<T>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<T>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<T>public void clear()
clear in interface Collection<T>public void insertBefore(List<T> toInsert, T point)
ChaintoInsert in the Chain before point.insertBefore in interface Chain<T>public void insertAfter(List<T> toInsert, T point)
ChaintoInsert in the Chain after point.insertAfter in interface Chain<T>public void insertAfter(T toInsert, T point)
ChaintoInsert in the Chain after point.insertAfter in interface Chain<T>public void insertBefore(T toInsert, T point)
ChaintoInsert in the Chain before point.insertBefore in interface Chain<T>public void insertBefore(Chain<T> toInsert, T point)
ChaintoInsert in the Chain before point. (It would probably be better to make Chain
implement List)insertBefore in interface Chain<T>public void insertAfter(Chain<T> toInsert, T point)
ChaintoInsert in the Chain after point. (It would probably be better to make Chain
implement List)insertAfter in interface Chain<T>public void swapWith(T out, T in)
Chainout in the Chain by in.public boolean remove(Object u)
ChainObject to be compatible with the
Collection interface.public void addFirst(T u)
Chainpublic void addLast(T u)
Chainpublic void removeFirst()
ChainremoveFirst in interface Chain<T>public void removeLast()
ChainremoveLast in interface Chain<T>public boolean follows(T someObject, T someReferenceObject)
ChainsomeObject follows object someReferenceObject in the Chain,
i.e. someReferenceObject comes first and then someObject.public T getFirst()
Chainpublic T getLast()
Chainpublic T getSuccOf(T point)
Chainpoint.public T getPredOf(T point)
Chainpoint.public Iterator<T> snapshotIterator()
ChainsnapshotIterator in interface Chain<T>public Iterator<T> iterator()
Chainpublic Iterator<T> iterator(Object u)
Chainpublic Iterator<T> iterator(Object head, Object tail)
Chainpublic int size()
Chainpublic long getModificationCount()
ChaingetModificationCount in interface Chain<T>public Collection<T> getElementsUnsorted()
ChaingetElementsUnsorted in interface Chain<T>public void insertAfter(Collection<? extends T> toInsert, T point)
ChaintoInsert in the Chain after point.insertAfter in interface Chain<T>public void insertBefore(Collection<? extends T> toInsert, T point)
ChaintoInsert in the Chain before point.insertBefore in interface Chain<T>Copyright © 2020 Soot OSS. All rights reserved.