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, getElementsByName
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getElementById
public ShardCacheViewImpl()
public ShardCacheViewImpl(int initialCapacity)
public void clear()
public gnu.trove.map.TIntObjectMap<JDA> getMap()
public java.util.List<JDA> asList()
CacheView
SortedSnowflakeCacheView
.public java.util.Set<JDA> asSet()
CacheView
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> 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 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>
@Nonnull public java.util.Iterator<JDA> iterator()
iterator
in interface java.lang.Iterable<JDA>
public JDA getElementById(int id)
ShardCacheView
getElementById
in interface ShardCacheView
id
- The ID of the entity