Java representation of a native Elektra key set, a container for keys.
More...
Inherits AbstractSet< Key >, and SortedSet< Key >.
|
| KeySet (long nativePointer) |
| Constructor associating a new KeySet instance with a native pointer in long format. More...
|
|
| KeySet (long nativePointer, boolean suppressCleanUp) |
| Constructor associating a new KeySet instance with a native pointer in long format
Suppressing clean-up has been introduced for usage of this binding as JNI plug-in and should normally not be used in any other case. More...
|
|
| KeySet (Pointer pointer) |
| Constructor associating a new KeySet instance with a JNA pointer. More...
|
|
Pointer | getPointer () |
|
Java representation of a native Elektra key set, a container for keys.
◆ KeySet() [1/3]
org.libelektra.KeySet.KeySet |
( |
long |
nativePointer | ) |
|
|
inlineprotected |
Constructor associating a new KeySet instance with a native pointer in long format.
- Parameters
-
nativePointer | Native pointer to key set in long format |
◆ KeySet() [2/3]
org.libelektra.KeySet.KeySet |
( |
long |
nativePointer, |
|
|
boolean |
suppressCleanUp |
|
) |
| |
|
inlineprotected |
Constructor associating a new KeySet instance with a native pointer in long format
Suppressing clean-up has been introduced for usage of this binding as JNI plug-in and should normally not be used in any other case.
- Parameters
-
◆ KeySet() [3/3]
org.libelektra.KeySet.KeySet |
( |
Pointer |
pointer | ) |
|
|
inlineprotected |
Constructor associating a new KeySet instance with a JNA pointer.
- Parameters
-
- Exceptions
-
IllegalArgumentException | if is |
- See also
- release()
◆ add()
boolean org.libelektra.KeySet.add |
( |
Key |
e | ) |
|
|
inline |
- Exceptions
-
IllegalStateException | if this KeySet or the specified has already been released |
NullPointerException | if is |
KeySetException | if inserting the failed because of allocation problems |
- See also
- append(Key)
◆ addAll()
boolean org.libelektra.KeySet.addAll |
( |
Collection<? extends Key > |
c | ) |
|
|
inline |
- Exceptions
-
IllegalStateException | if this KeySet or any Key contained in the specified collection has already been released |
NullPointerException | if the specified collection is or contains elements |
KeySetException | if inserting the failed because of allocation problems |
◆ append() [1/2]
KeySet org.libelektra.KeySet.append |
( |
Key |
key | ) |
|
|
inline |
Append key to key set.
- Parameters
-
- Returns
- This KeySet, enabling a fluent interface
- Exceptions
-
IllegalStateException | if this KeySet or the specified has already been released |
IllegalArgumentException | if is |
KeySetException | if appending the failed because of allocation problems |
- See also
- add(Key)
◆ append() [2/2]
Appends keys from key set.
- Parameters
-
- Returns
- This KeySet, enabling a fluent interface
- Exceptions
-
IllegalStateException | if this KeySet or the specified has already been released |
IllegalArgumentException | if is |
KeySetException | if appending the failed because of allocation problems |
◆ at()
Key org.libelektra.KeySet.at |
( |
int |
cursor | ) |
|
|
inline |
Gets the key at the given cursor position.
- Parameters
-
cursor | Cursor position used to fetch key; starting from 0 |
- Returns
- Key found at specified cursor position
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
IndexOutOfBoundsException | if position is out of bounds |
- See also
- Key::release()
◆ clear()
void org.libelektra.KeySet.clear |
( |
| ) |
|
|
inline |
Removes all elements form this KeySet.
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
◆ comparator()
Comparator<? super Key> org.libelektra.KeySet.comparator |
( |
| ) |
|
|
inline |
@implSpec Returns
because natural ordering of keys is used (ReadableKey implements Comparable)
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
◆ contains()
boolean org.libelektra.KeySet.contains |
( |
@Nullable Object |
o | ) |
|
|
inline |
- Exceptions
-
IllegalStateException | if this KeySet has already been released or the passed o is a Key that has already been released |
NullPointerException | if the specified element is |
- See also
- lookup(Key)
◆ containsAll()
boolean org.libelektra.KeySet.containsAll |
( |
Collection<?> |
c | ) |
|
|
inline |
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
NullPointerException | if the specified collection is or contains elements |
◆ copy()
Copies key references from.
to this KeySet
- Parameters
-
source | Key set that is used as source |
- Returns
- This KeySet, enabling a fluent interface
- Exceptions
-
IllegalStateException | if this KeySet or the specified has already been released |
IllegalArgumentException | if is |
◆ create() [1/3]
static KeySet org.libelektra.KeySet.create |
( |
| ) |
|
|
inlinestatic |
Constructs an empty KeySet with a default allocation hint of 16.
- Returns
- Newly allocated key set
- Exceptions
-
KeySetException | on allocation problems |
- See also
- release()
◆ create() [2/3]
static KeySet org.libelektra.KeySet.create |
( |
int |
allocationHint, |
|
|
Key... |
keys |
|
) |
| |
|
inlinestatic |
Constructs a new KeySet containing the specified keys
Example: KeySet keySet = KeySet.create(10, Key.create("A"), Key.create("B"));.
- Parameters
-
allocationHint | Hint indicating the expected size of the key set |
keys | List of initial keys for the key set |
- Returns
- New key set containing the specified initial keys
- Exceptions
-
KeySetException | on allocation problems |
- See also
- release()
◆ create() [3/3]
static KeySet org.libelektra.KeySet.create |
( |
Key... |
keys | ) |
|
|
inlinestatic |
Constructs a new KeySet containing the specified keys
Example: KeySet keySet = KeySet.create(Key.create("A"), Key.create("B"));.
- Parameters
-
keys | List of initial keys for the key set |
- Returns
- New key set containing the specified initial keys
- Exceptions
-
KeySetException | on allocation problems |
- See also
- release()
◆ cut()
KeySet org.libelektra.KeySet.cut |
( |
Key |
cutpoint | ) |
|
|
inline |
Creates new key set with help of a cut point.
- Parameters
-
cutpoint | Key that is used as cutting point |
- Returns
- New KeySet containing all keys until the cutting point
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
IllegalArgumentException | if is |
KeySetException | if is missing a key name or on allocation problems |
- See also
- release()
◆ dup()
KeySet org.libelektra.KeySet.dup |
( |
| ) |
|
|
inline |
Duplicates the key set.
- Returns
- New KeySet containing the same key references as this KeySet does
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
- See also
- release()
◆ first()
Key org.libelektra.KeySet.first |
( |
| ) |
|
|
inline |
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
NoSuchElementException | |
- See also
- Key::release()
◆ getPointer()
Pointer org.libelektra.KeySet.getPointer |
( |
| ) |
|
|
inlineprotected |
- Returns
- JNA pointer to the native pointer for this key set
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
◆ headSet()
SortedSet<Key> org.libelektra.KeySet.headSet |
( |
Key |
toElement | ) |
|
|
inline |
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
NullPointerException | if is |
IllegalArgumentException | |
◆ indexOf()
int org.libelektra.KeySet.indexOf |
( |
Key |
key | ) |
|
|
inline |
- Parameters
-
- Returns
- Index of the in this KeySet
- Exceptions
-
IllegalStateException | if KeySet or has already been released |
IllegalArgumentException | if was not found in this KeySet |
◆ isEmpty()
boolean org.libelektra.KeySet.isEmpty |
( |
| ) |
|
|
inline |
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
◆ iterator()
Iterator<Key> org.libelektra.KeySet.iterator |
( |
| ) |
|
|
inline |
◆ last()
Key org.libelektra.KeySet.last |
( |
| ) |
|
|
inline |
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
NoSuchElementException | |
- See also
- Key::release()
◆ lookup() [1/2]
Optional<Key> org.libelektra.KeySet.lookup |
( |
Key |
find | ) |
|
|
inline |
Search for a key in the key set.
- Parameters
-
- Returns
- Key if search successful, Optional#empty() otherwise
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
IllegalArgumentException | if is |
- See also
- Key::release()
-
#contains(Object)
◆ lookup() [2/2]
Optional<Key> org.libelektra.KeySet.lookup |
( |
String |
find | ) |
|
|
inline |
Search for a key in the key set.
- Parameters
-
find | Key name used in search |
- Returns
- Key if search successful, Optional#empty() otherwise
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
IllegalArgumentException | if is blank |
- See also
- Key::release()
◆ release()
void org.libelektra.KeySet.release |
( |
| ) |
|
|
inline |
Clean-up method to release key set reference by trying to free the native reference
Call this method if you have obtained a KeySet via any of its public methods or {} and you do not longer need it.
If you do not manually release such key sets, they will get cleaned up by garbage collection as soon as they get phantom reachable. Therefore its encouraged to release key set instances as soon as you do not use them anymore.
◆ remove() [1/4]
Key org.libelektra.KeySet.remove |
( |
int |
cursor | ) |
|
|
inline |
Returns key from key set and also removes it from the set.
- Parameters
-
cursor | Cursor position of the key to remove; starting from 0 |
- Returns
- Key found at given cursor position
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
IndexOutOfBoundsException | if position is out of bounds |
- See also
- Key::release()
◆ remove() [2/4]
boolean org.libelektra.KeySet.remove |
( |
Object |
o | ) |
|
|
inline |
◆ remove() [3/4]
Removes the specified key from key set.
- Parameters
-
- Returns
- Removed Key from the key set, matching the specified 's name. May or may not reference the same native key resource. Optional#empty() if the specified was not found.
- Exceptions
-
IllegalStateException | if KeySet or has already been released |
IllegalArgumentException | if is |
- See also
- remove(Object)
◆ remove() [4/4]
Optional<Key> org.libelektra.KeySet.remove |
( |
String |
find | ) |
|
|
inline |
◆ removeAll()
boolean org.libelektra.KeySet.removeAll |
( |
Collection<?> |
c | ) |
|
|
inline |
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
NullPointerException | if the specified collection is or contains elements |
◆ retainAll()
boolean org.libelektra.KeySet.retainAll |
( |
Collection<?> |
c | ) |
|
|
inline |
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
NullPointerException | if the specified collection is or contains elements |
◆ size()
int org.libelektra.KeySet.size |
( |
| ) |
|
|
inline |
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
◆ subSet()
SortedSet<Key> org.libelektra.KeySet.subSet |
( |
Key |
fromElement, |
|
|
Key |
toElement |
|
) |
| |
|
inline |
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
NullPointerException | if or is |
IllegalArgumentException | |
◆ tailSet()
SortedSet<Key> org.libelektra.KeySet.tailSet |
( |
Key |
fromElement | ) |
|
|
inline |
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
NullPointerException | if is |
IllegalArgumentException | |
◆ toArray()
Object [] org.libelektra.KeySet.toArray |
( |
| ) |
|
|
inline |
- Exceptions
-
IllegalStateException | if this KeySet has already been released |
◆ toString()
String org.libelektra.KeySet.toString |
( |
| ) |
|
|
inline |
Iterates though all keys in this key set and appends their representation to the output.
Uses the toString() function of the Key objects.
- Returns
- Represents this KeySet as string
The documentation for this class was generated from the following file: