Top Description Fields Constructors Methods
io.netty5.util.internal.shaded.org.jctools.maps

public Class NonBlockingHashSet<E>

extends AbstractSet<E>
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.Serializable, java.util.AbstractSet, .Iterator, .Set

A simple wrapper around NonBlockingHashMap making it implement the Set interface. All operations are Non-Blocking and multi-thread safe.
Author
Cliff Click
Since
1.5

Field Summary

Modifier and TypeField and Description
private final NonBlockingHashMap<E, Object>
private static final Object
V

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if o was added to the set, false if o was already in the set.
add
(final E
element to be added to this set
o
)

Overrides java.util.AbstractCollection.add.

Implements java.util.Set.add, java.util.Collection.add.

Add o to the set.
public void
public boolean

Returns:

true if o is in the set.
contains
(final Object
element whose presence in this set is to be tested
o
)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Returns true if this set contains the specified element.
public E

Returns:

Returns the match for o if o is in the set.
get
(final E o)

public Iterator<E>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this set.
public boolean

Returns:

true if o was removed to the set, false if o was not in the set.
remove
(final Object
object to be removed from this set, if present
o
)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Remove o from the set.
public int

Returns:

count of elements.
size
()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Current count of elements in the set.
Inherited from java.util.AbstractSet:
equalshashCoderemoveAll

Field Detail

_mapback to summary
private final NonBlockingHashMap<E, Object> _map
Vback to summary
private static final Object V

Constructor Detail

NonBlockingHashSetback to summary
public NonBlockingHashSet()

Make a new empty NonBlockingHashSet.

Method Detail

addback to summary
public boolean add(final E o)

Overrides java.util.AbstractCollection.add.

Implements java.util.Set.add, java.util.Collection.add.

Add o to the set.

Parameters
o:E

Doc from java.util.Set.add.

element to be added to this set

Returns:boolean

true if o was added to the set, false if o was already in the set.

clearback to summary
public void clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Empty the set.

containsback to summary
public boolean contains(final Object o)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Doc from java.util.Set.contains.

Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that Objects.equals(o, e).

Parameters
o:Object

element whose presence in this set is to be tested

Returns:boolean

true if o is in the set.

getback to summary
public E get(final E o)
Returns:E

Returns the match for o if o is in the set.

iteratorback to summary
public Iterator<E> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Doc from java.util.Set.iterator.

Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).

Returns:Iterator<E>

an iterator over the elements in this set

removeback to summary
public boolean remove(final Object o)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Remove o from the set.

Parameters
o:Object

Doc from java.util.Set.remove.

object to be removed from this set, if present

Returns:boolean

true if o was removed to the set, false if o was not in the set.

sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Current count of elements in the set. Due to concurrent racing updates, the size is only ever approximate. Updates due to the calling thread are immediately visible to calling thread.

Returns:int

count of elements.