Class RosterMap
java.lang.Object
moe.kyokobot.libdave.RosterMap
A read-only map representing the roster of participants in a DAVE session and their associated key data.
This maps user IDs (Long) to their key material (byte[]).
In the context of CommitResult, this map represents changes: an entry with a value indicates an add/update,
while an entry might represent removal depending on context (though typically removals might be explicit or implied by absence in a full snapshot,
but specifically for commit results, it lists changed IDs).
Note: The implementation is backed by native arrays and is immutable.
-
Nested Class Summary
-
Constructor Summary
ConstructorsConstructorDescriptionRosterMap(long[] keys, byte[][] values) Creates a roster map from parallel arrays. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()byte[]get(long key) Returns the key data for a user ID without boxing.byte[]booleanisEmpty()keySet()byte[]voidbyte[]intsize()@NotNull Collection<byte[]> values()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
RosterMap
public RosterMap(long[] keys, byte[][] values) Creates a roster map from parallel arrays. The arrays are used as-is and must not be modified afterwards.- Parameters:
keys- The user IDs.values- The key data for each user ID, at the same index as inkeys.- Throws:
IllegalArgumentException- if the arrays differ in length.NullPointerException- if any value is null.
-
-
Method Details
-
size
-
isEmpty
-
containsKey
- Specified by:
containsKeyin interfaceMap<Long,byte[]>
-
containsValue
- Specified by:
containsValuein interfaceMap<Long,byte[]>
-
get
-
get
public byte[] get(long key) Returns the key data for a user ID without boxing.- Parameters:
key- The user ID.- Returns:
- The key data, or null if the user ID is not in the roster.
-
put
-
remove
-
putAll
-
clear
-
keySet
-
values
-
entrySet
-