public final class NaiveTxnStack<E> extends AbstractTxnCollection<E> implements TxnStack<E>
defaultRefFactory, stm
Constructor and Description |
---|
NaiveTxnStack(Stm stm) |
NaiveTxnStack(Stm stm,
int capacity) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(Txn tx,
E e)
Ensures that this collection contains the specified element (optional
operation).
|
void |
clear(Txn tx)
Removes all of the elements from this collection (optional operation).
|
boolean |
contains(Txn tx,
Object o)
Returns true if this collection contains the specified element.
|
int |
getCapacity() |
TxnIterator<E> |
iterator(Txn tx)
Returns an iterator over a set of elements of type T.
|
boolean |
offer(E item) |
boolean |
offer(Txn tx,
E item) |
E |
peek() |
E |
peek(Txn tx) |
E |
poll() |
E |
poll(Txn tx) |
E |
pop() |
E |
pop(Txn tx) |
void |
push(E item) |
void |
push(Txn tx,
E item) |
boolean |
remove(Txn tx,
Object o)
Removes a single instance of the specified element from this
collection, if it is present (optional operation).
|
int |
size(Txn tx)
Returns the number of elements in this collection.
|
String |
toString(Txn tx) |
add, addAll, addAll, addAll, addAll, clear, contains, containsAll, containsAll, getStm, isEmpty, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAll, addAll, addAll, containsAll, getStm, isEmpty
iterator
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
public NaiveTxnStack(Stm stm)
public NaiveTxnStack(Stm stm, int capacity)
public int size(Txn tx)
TxnCollection
size
in interface TxnCollection<E>
tx
- the transaction used for this operation.public int getCapacity()
getCapacity
in interface TxnStack<E>
public void clear(Txn tx)
TxnCollection
clear
in interface TxnCollection<E>
tx
- the transaction used for this operation.public boolean add(Txn tx, E e)
TxnCollection
Collections that support this operation may place limitations on what elements may be added to this collection. In particular, some collections will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. Collection classes should clearly specify in their documentation any restrictions on what elements may be added.
If a collection refuses to add a particular element for any reason other than that it already contains the element, it must throw an exception (rather than returning false). This preserves the invariant that a collection always contains the specified element after this call returns.
add
in interface TxnCollection<E>
tx
- the transaction used for this operation.e
- element whose presence in this collection is to be ensuredpublic TxnIterator<E> iterator(Txn tx)
TxnIterable
iterator
in interface TxnIterable<E>
tx
- the Txn used for this Operation.public boolean contains(Txn tx, Object o)
TxnCollection
contains
in interface TxnCollection<E>
tx
- the transaction used for this operation.o
- element whose presence in this collection is to be testedpublic boolean remove(Txn tx, Object o)
TxnCollection
remove
in interface TxnCollection<E>
tx
- the transaction used for this operation.o
- element to be removed from this collection, if presentpublic String toString(Txn tx)
toString
in interface TxnCollection<E>
Copyright © 2020. All rights reserved.