public final class CollisionCheckStack<E> extends AbstractList<E>
Stack
-like data structure that allows the following efficient operations:
Object equality is their identity equality.
This class implements List
for accessing items in the stack,
but List
methods that alter the stack is not supported.
modCount
Constructor and Description |
---|
CollisionCheckStack() |
Modifier and Type | Method and Description |
---|---|
boolean |
findDuplicate(E o) |
E |
get(int index) |
String |
getCycleString()
String that represents the cycle.
|
boolean |
getLatestPushResult() |
boolean |
getUseIdentity() |
E |
peek()
Returns the top of the stack.
|
E |
pop()
Pops an object from the stack
|
boolean |
push(E o)
Pushes a new object to the stack.
|
void |
pushNocheck(E o)
Pushes a new object to the stack without making it participate
with the collision check.
|
void |
reset()
Clears all the contents in the stack.
|
void |
setUseIdentity(boolean useIdentity)
Set to false to use
Object.equals(Object) to detect cycles. |
int |
size() |
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
public void setUseIdentity(boolean useIdentity)
Object.equals(Object)
to detect cycles.
This method can be only used when the stack is empty.public boolean getUseIdentity()
public boolean getLatestPushResult()
public boolean push(E o)
public void pushNocheck(E o)
public boolean findDuplicate(E o)
public E get(int index)
public int size()
size
in interface Collection<E>
size
in interface List<E>
size
in class AbstractCollection<E>
public E pop()
public E peek()
public void reset()
public String getCycleString()
Copyright © 2020 JBoss by Red Hat. All rights reserved.