Package org.aion.avm.userlib
Class AionSet<E>
- java.lang.Object
-
- org.aion.avm.userlib.AionSet<E>
-
- Type Parameters:
E
- The type of elements within the set.
- All Implemented Interfaces:
java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.Set<E>
public class AionSet<E> extends java.lang.Object implements java.util.Set<E>
A simple Set implementation.This implementation is build directly on top of
AionMap
.
-
-
Constructor Summary
Constructors Constructor Description AionSet()
Constructs a new, empty set; the backingAionMap
instance has default order(4).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E e)
Adds the specified element to this set if it is not already present.boolean
addAll(java.util.Collection<? extends E> c)
This implementation iterates over the specified collection, and adds each object returned by the iterator to this collection, in turn.void
clear()
Removes all of the elements from this set.boolean
contains(java.lang.Object o)
Returnstrue
if this set contains the specified element.boolean
containsAll(java.util.Collection<?> c)
This implementation iterates over the specified collection, checking each element returned by the iterator in turn to see if it's contained in this collection.boolean
isEmpty()
Returnstrue
if this set contains no elements.java.util.Iterator<E>
iterator()
Returns an iterator over the elements in this set.boolean
remove(java.lang.Object o)
Removes the specified element from this set if it is present.boolean
removeAll(java.util.Collection<?> c)
boolean
retainAll(java.util.Collection<?> c)
int
size()
Returns the number of elements in this set (its cardinality).java.lang.Object[]
toArray()
<T> T[]
toArray(T[] a)
-
-
-
Method Detail
-
size
public int size()
Returns the number of elements in this set (its cardinality).
-
isEmpty
public boolean isEmpty()
Returnstrue
if this set contains no elements.
-
contains
public boolean contains(java.lang.Object o)
Returnstrue
if this set contains the specified element. More formally, returnstrue
if and only if this set contains an elemente
such thatObjects.equals(o, e)
.
-
toArray
public java.lang.Object[] toArray()
-
toArray
public <T> T[] toArray(T[] a)
-
add
public boolean add(E e)
Adds the specified element to this set if it is not already present. More formally, adds the specified elemente
to this set if this set contains no elemente2
such thatObjects.equals(e, e2)
. If this set already contains the element, the call leaves the set unchanged and returnsfalse
.
-
remove
public boolean remove(java.lang.Object o)
Removes the specified element from this set if it is present. More formally, removes an elemente
such thatObjects.equals(o, e)
, if this set contains such an element. Returnstrue
if this set contained the element (or equivalently, if this set changed as a result of the call). (This set will not contain the element once the call returns.)
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
This implementation iterates over the specified collection, checking each element returned by the iterator in turn to see if it's contained in this collection. If all elements are so containedtrue
is returned, otherwisefalse
.- Specified by:
containsAll
in interfacejava.util.Collection<E>
- Specified by:
containsAll
in interfacejava.util.Set<E>
- See Also:
contains(Object)
-
addAll
public boolean addAll(java.util.Collection<? extends E> c)
This implementation iterates over the specified collection, and adds each object returned by the iterator to this collection, in turn.- Specified by:
addAll
in interfacejava.util.Collection<E>
- Specified by:
addAll
in interfacejava.util.Set<E>
- See Also:
add(Object)
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
clear
public void clear()
Removes all of the elements from this set. The set will be empty after this call returns.
-
iterator
public java.util.Iterator<E> iterator()
Returns an iterator over the elements in this set. The elements are returned in no particular order.
-
-