public class FastSet<E> extends FastCollection<E> implements Set<E>
A high-performance set with real-time
behavior;
smooth capacity increase/decrease and minimal memory footprint.
The iteration order over the set elements is deterministic
(unlike HashSet
).It is either the insertion order (default)
or the key order for the FastSortedSet
subclass.
This class permits null
elements.
FastCollection.StandardText
Modifier | Constructor and Description |
---|---|
|
FastSet()
Creates an empty set backed up by a
FastMap and having
the same real-time characteristics. |
|
FastSet(EqualityComparator<? super E> comparator)
Creates an empty set backed up by a
FastMap and using the
specified comparator for key equality. |
protected |
FastSet(SetService<E> service)
Creates a fast set backed up by the specified service implementation.
|
Modifier and Type | Method and Description |
---|---|
FastSet<E> |
addAll(E... elements)
Misc.
|
FastSet<E> |
addAll(FastCollection<? extends E> that)
Returns this collection with the specified collection's elements added.
|
void |
clear() |
boolean |
contains(Object obj) |
FastSet<E> |
distinct()
Returns a view exposing only distinct elements (it does not iterate twice
over the
same elements). |
FastSet<E> |
filtered(Predicate<? super E> filter)
Returns a view exposing only the elements matching the specified
filter.
|
boolean |
isEmpty()
Set operations optimizations.
|
boolean |
remove(Object obj) |
protected SetService<E> |
service()
Returns the service implementation of this collection (for sub-classes).
|
FastSet<E> |
shared()
Returns a thread-safe view over this collection.
|
int |
size() |
FastSet<E> |
unmodifiable()
Views.
|
add, addAll, atomic, comparator, comparator, containsAll, doWhile, equals, forEach, hashCode, iterator, mapped, parallel, reduce, removeAll, removeIf, retainAll, reversed, sequential, serviceOf, sorted, toArray, toArray, toImmutable, toString
public FastSet()
FastMap
and having
the same real-time characteristics.public FastSet(EqualityComparator<? super E> comparator)
FastMap
and using the
specified comparator for key equality.protected FastSet(SetService<E> service)
public FastSet<E> unmodifiable()
unmodifiable
in class FastCollection<E>
public FastSet<E> shared()
FastCollection
immutable
collections to be replaced at each update rather than shared views.shared
in class FastCollection<E>
public FastSet<E> filtered(Predicate<? super E> filter)
FastCollection
filtered
in class FastCollection<E>
public FastSet<E> distinct()
FastCollection
same
elements). Adding elements already
in the collection through this view has no effect (if this collection is
initially empty, using the distinct view prevents element duplication).distinct
in class FastCollection<E>
@Realtime(limit=CONSTANT) public boolean isEmpty()
isEmpty
in interface Collection<E>
isEmpty
in interface Set<E>
isEmpty
in class FastCollection<E>
@Realtime(limit=CONSTANT) public int size()
size
in interface Collection<E>
size
in interface Set<E>
size
in class FastCollection<E>
@Realtime(limit=CONSTANT) public void clear()
clear
in interface Collection<E>
clear
in interface Set<E>
clear
in class FastCollection<E>
@Realtime(limit=CONSTANT) public boolean contains(Object obj)
contains
in interface Collection<E>
contains
in interface Set<E>
contains
in class FastCollection<E>
@Realtime(limit=CONSTANT) public boolean remove(Object obj)
remove
in interface Collection<E>
remove
in interface Set<E>
remove
in class FastCollection<E>
public FastSet<E> addAll(E... elements)
addAll
in class FastCollection<E>
elements
- the elements to be added.this
public FastSet<E> addAll(FastCollection<? extends E> that)
FastCollection
addAll
in class FastCollection<E>
protected SetService<E> service()
FastCollection
service
in class FastCollection<E>
Copyright © 2005-2013 Javolution. All Rights Reserved.