java.lang.Iterable<JDA>, ShardCacheView, CacheView<JDA>public static class ShardCacheViewImpl.UnifiedShardCacheViewImpl extends java.lang.Object implements ShardCacheView
CacheView.SimpleCacheView<T>| Constructor | Description |
|---|---|
UnifiedShardCacheViewImpl(java.util.function.Supplier<java.util.stream.Stream<ShardCacheView>> generator) |
| Modifier and Type | Method | Description |
|---|---|---|
java.util.List<JDA> |
asList() |
Creates an immutable snapshot of the current cache state.
|
java.util.Set<JDA> |
asSet() |
Creates an immutable snapshot of the current cache state.
|
JDA |
getElementById(int id) |
Retrieves the JDA instance represented by the provided shard ID.
|
java.util.List<JDA> |
getElementsByName(java.lang.String name,
boolean ignoreCase) |
Creates an immutable list of all elements matching the given name.
|
boolean |
isEmpty() |
Whether the cache is empty
|
java.util.Iterator<JDA> |
iterator() |
|
java.util.stream.Stream<JDA> |
parallelStream() |
Creates a parallel
Stream of all cached elements. |
long |
size() |
The current size of this cache
This is a long as it may be a projected view of multiple caches
(See CacheView.all(java.util.function.Supplier)) |
java.util.stream.Stream<JDA> |
stream() |
Creates a
Stream of all cached elements. |
all, all, allMembers, allMembers, allShards, allShards, allSnowflakes, allSnowflakes, collect, getElementsByNameequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetElementByIdpublic UnifiedShardCacheViewImpl(java.util.function.Supplier<java.util.stream.Stream<ShardCacheView>> generator)
public long size()
CacheViewlong as it may be a projected view of multiple caches
(See CacheView.all(java.util.function.Supplier))
This is more efficient than creating a list or set snapshot first as it checks the size of the internal cache directly.
public boolean isEmpty()
CacheViewThis is more efficient than creating a list or set snapshot first as it checks the size
of the internal cache directly.
On a projected cache view this will simply look through all projected views and return false
the moment it finds one that is not empty.
public java.util.List<JDA> asList()
CacheViewSortedSnowflakeCacheView.public java.util.Set<JDA> asSet()
CacheViewpublic java.util.List<JDA> getElementsByName(java.lang.String name, boolean ignoreCase)
CacheViewMemberCacheView this will
check the Effective Name of the cached members.getElementsByName in interface CacheView<JDA>name - The name to checkignoreCase - Whether to ignore case when comparing namespublic JDA getElementById(int id)
ShardCacheViewgetElementById in interface ShardCacheViewid - The ID of the entitypublic java.util.stream.Stream<JDA> stream()
CacheViewStream of all cached elements.
SortedSnowflakeCacheView.public java.util.stream.Stream<JDA> parallelStream()
CacheViewStream of all cached elements.
SortedSnowflakeCacheView.parallelStream in interface CacheView<JDA>