java.lang.Iterable<JDA>, ShardCacheView, CacheView<JDA>public class ShardCacheViewImpl extends java.lang.Object implements ShardCacheView
| Modifier and Type | Class | Description |
|---|---|---|
static class |
ShardCacheViewImpl.UnifiedShardCacheViewImpl |
CacheView.SimpleCacheView<T>| Constructor | Description |
|---|---|
ShardCacheViewImpl() |
|
ShardCacheViewImpl(int initialCapacity) |
| 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.
|
void |
clear() |
|
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.
|
gnu.trove.map.TIntObjectMap<JDA> |
getMap() |
|
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, getElementsByNameequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetElementByIdpublic ShardCacheViewImpl()
public ShardCacheViewImpl(int initialCapacity)
public void clear()
public gnu.trove.map.TIntObjectMap<JDA> getMap()
public java.util.List<JDA> asList()
CacheViewSortedSnowflakeCacheView.public java.util.Set<JDA> asSet()
CacheViewpublic 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> 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 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>@Nonnull public java.util.Iterator<JDA> iterator()
iterator in interface java.lang.Iterable<JDA>public JDA getElementById(int id)
ShardCacheViewgetElementById in interface ShardCacheViewid - The ID of the entity