public class NioSelectedKeySet
extends java.util.AbstractSet<java.nio.channels.SelectionKey>
Selector
. Akin to netty's SelectedSelectionKeySet.
Assumes single threaded usage.Constructor and Description |
---|
NioSelectedKeySet()
Construct a key set with default capacity
|
NioSelectedKeySet(int initialCapacity)
Construct a key set with the given capacity.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(java.nio.channels.SelectionKey selectionKey) |
int |
capacity()
Capacity of the current set
|
boolean |
contains(java.lang.Object o) |
int |
forEach(java.util.function.ToIntFunction<java.nio.channels.SelectionKey> function)
Iterate over the key set and apply the given function.
|
java.util.Iterator<java.nio.channels.SelectionKey> |
iterator() |
java.nio.channels.SelectionKey[] |
keys()
Return selected keys.
|
boolean |
remove(java.lang.Object o) |
void |
reset()
Reset for next iteration.
|
int |
size() |
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
public NioSelectedKeySet()
public NioSelectedKeySet(int initialCapacity)
initialCapacity
- for the key setpublic int size()
size
in interface java.util.Collection<java.nio.channels.SelectionKey>
size
in interface java.util.Set<java.nio.channels.SelectionKey>
size
in class java.util.AbstractCollection<java.nio.channels.SelectionKey>
public int capacity()
public boolean add(java.nio.channels.SelectionKey selectionKey)
add
in interface java.util.Collection<java.nio.channels.SelectionKey>
add
in interface java.util.Set<java.nio.channels.SelectionKey>
add
in class java.util.AbstractCollection<java.nio.channels.SelectionKey>
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection<java.nio.channels.SelectionKey>
remove
in interface java.util.Set<java.nio.channels.SelectionKey>
remove
in class java.util.AbstractCollection<java.nio.channels.SelectionKey>
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection<java.nio.channels.SelectionKey>
contains
in interface java.util.Set<java.nio.channels.SelectionKey>
contains
in class java.util.AbstractCollection<java.nio.channels.SelectionKey>
public java.nio.channels.SelectionKey[] keys()
public void reset()
public int forEach(java.util.function.ToIntFunction<java.nio.channels.SelectionKey> function)
function
- to apply to each SelectionKey
public java.util.Iterator<java.nio.channels.SelectionKey> iterator()
iterator
in interface java.lang.Iterable<java.nio.channels.SelectionKey>
iterator
in interface java.util.Collection<java.nio.channels.SelectionKey>
iterator
in interface java.util.Set<java.nio.channels.SelectionKey>
iterator
in class java.util.AbstractCollection<java.nio.channels.SelectionKey>
Copyright © 2014-2019 Real Logic Ltd. All Rights Reserved.