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. |
collect, getElementsByName
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getElementById
public UnifiedShardCacheViewImpl(java.util.function.Supplier<java.util.stream.Stream<ShardCacheView>> generator)
public long size()
CacheView
long
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()
CacheView
This 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()
CacheView
SortedSnowflakeCacheView
.public java.util.Set<JDA> asSet()
CacheView
public java.util.List<JDA> getElementsByName(java.lang.String name, boolean ignoreCase)
CacheView
MemberCacheView
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)
ShardCacheView
getElementById
in interface ShardCacheView
id
- The ID of the entitypublic java.util.stream.Stream<JDA> stream()
CacheView
Stream
of all cached elements.
SortedSnowflakeCacheView
.public java.util.stream.Stream<JDA> parallelStream()
CacheView
Stream
of all cached elements.
SortedSnowflakeCacheView
.parallelStream
in interface CacheView<JDA>