Class SortedSnowflakeCacheViewImpl<T extends ISnowflake & Comparable<? super T>>
java.lang.Object
net.dv8tion.jda.internal.utils.cache.ReadWriteLockCache<T>
net.dv8tion.jda.internal.utils.cache.AbstractCacheView<T>
net.dv8tion.jda.internal.utils.cache.SnowflakeCacheViewImpl<T>
net.dv8tion.jda.internal.utils.cache.SortedSnowflakeCacheViewImpl<T>
- All Implemented Interfaces:
Iterable<T>
,CacheView<T>
,SnowflakeCacheView<T>
,SortedSnowflakeCacheView<T>
public class SortedSnowflakeCacheViewImpl<T extends ISnowflake & Comparable<? super T>>
extends SnowflakeCacheViewImpl<T>
implements SortedSnowflakeCacheView<T>
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.utils.cache.CacheView
CacheView.SimpleCacheView<T>
-
Constructor Summary
ConstructorsConstructorDescriptionSortedSnowflakeCacheViewImpl
(Class<T> type, Comparator<T> comparator) SortedSnowflakeCacheViewImpl
(Class<T> type, Function<T, String> nameMapper, Comparator<T> comparator) -
Method Summary
Modifier and TypeMethodDescriptionasList()
Creates an immutable snapshot of the current cache state.asSet()
Creates an immutable snapshot of the current cache state.void
void
forEachUnordered
(Consumer<? super T> action) Behavior similar toIterable.forEach(Consumer)
but does not preserve order.getElementsByName
(String name, boolean ignoreCase) Creates an immutable list of all elements matching the given name.iterator()
Creates a parallelStream
of all cached elements.Behavior similar toCacheView.parallelStream()
which does not preserve order.stream()
Creates aStream
of all cached elements.Behavior similar toCacheView.stream()
which does not preserve order.Methods inherited from class net.dv8tion.jda.internal.utils.cache.SnowflakeCacheViewImpl
getElementById
Methods inherited from class net.dv8tion.jda.internal.utils.cache.AbstractCacheView
clear, equals, get, getMap, hashCode, isEmpty, keySet, lockedIterator, remove, size, toString
Methods inherited from class net.dv8tion.jda.internal.utils.cache.ReadWriteLockCache
clearCachedLists, readLock, writeLock
Methods inherited from interface net.dv8tion.jda.api.utils.cache.CacheView
acceptStream, applyStream, collect, getElementsByName, isEmpty, lockedIterator, size
Methods inherited from interface net.dv8tion.jda.api.utils.cache.SnowflakeCacheView
getElementById, getElementById
-
Constructor Details
-
SortedSnowflakeCacheViewImpl
-
SortedSnowflakeCacheViewImpl
-
-
Method Details
-
forEach
- Specified by:
forEach
in interfaceIterable<T extends ISnowflake & Comparable<? super T>>
- Overrides:
forEach
in classAbstractCacheView<T extends ISnowflake & Comparable<? super T>>
-
forEachUnordered
Description copied from interface:SortedSnowflakeCacheView
Behavior similar toIterable.forEach(Consumer)
but does not preserve order.
This will not copy the data store as sorting is not needed.- Specified by:
forEachUnordered
in interfaceCacheView<T extends ISnowflake & Comparable<? super T>>
- Specified by:
forEachUnordered
in interfaceSortedSnowflakeCacheView<T extends ISnowflake & Comparable<? super T>>
- Parameters:
action
- The action to perform
-
asList
Description copied from interface:CacheView
Creates an immutable snapshot of the current cache state.
This will copy all elements contained in this cache into a list.
This will be sorted for aSortedSnowflakeCacheView
.- Specified by:
asList
in interfaceCacheView<T extends ISnowflake & Comparable<? super T>>
- Overrides:
asList
in classAbstractCacheView<T extends ISnowflake & Comparable<? super T>>
- Returns:
- Immutable list of cached elements
-
asSet
Description copied from interface:CacheView
Creates an immutable snapshot of the current cache state.
This will copy all elements contained in this cache into a set.- Specified by:
asSet
in interfaceCacheView<T extends ISnowflake & Comparable<? super T>>
- Specified by:
asSet
in interfaceSortedSnowflakeCacheView<T extends ISnowflake & Comparable<? super T>>
- Overrides:
asSet
in classAbstractCacheView<T extends ISnowflake & Comparable<? super T>>
- Returns:
- Immutable set of cached elements
-
getElementsByName
Description copied from interface:CacheView
Creates an immutable list of all elements matching the given name.
For aMemberCacheView
this will check theEffective Name
of the cached members.- Specified by:
getElementsByName
in interfaceCacheView<T extends ISnowflake & Comparable<? super T>>
- Overrides:
getElementsByName
in classAbstractCacheView<T extends ISnowflake & Comparable<? super T>>
- Parameters:
name
- The name to checkignoreCase
- Whether to ignore case when comparing names- Returns:
- Immutable list of elements with the given name
-
spliterator
- Specified by:
spliterator
in interfaceIterable<T extends ISnowflake & Comparable<? super T>>
- Overrides:
spliterator
in classAbstractCacheView<T extends ISnowflake & Comparable<? super T>>
-
streamUnordered
Description copied from interface:SortedSnowflakeCacheView
Behavior similar toCacheView.stream()
which does not preserve order.- Specified by:
streamUnordered
in interfaceSortedSnowflakeCacheView<T extends ISnowflake & Comparable<? super T>>
- Returns:
- Stream of the contained elements
-
parallelStreamUnordered
Description copied from interface:SortedSnowflakeCacheView
Behavior similar toCacheView.parallelStream()
which does not preserve order.- Specified by:
parallelStreamUnordered
in interfaceSortedSnowflakeCacheView<T extends ISnowflake & Comparable<? super T>>
- Returns:
- (Parallel) Stream of contained elements
-
stream
Description copied from interface:CacheView
- Specified by:
stream
in interfaceCacheView<T extends ISnowflake & Comparable<? super T>>
- Overrides:
stream
in classAbstractCacheView<T extends ISnowflake & Comparable<? super T>>
- Returns:
- Stream of elements
-
parallelStream
Description copied from interface:CacheView
Creates a parallelStream
of all cached elements.
This will be sorted for aSortedSnowflakeCacheView
.- Specified by:
parallelStream
in interfaceCacheView<T extends ISnowflake & Comparable<? super T>>
- Overrides:
parallelStream
in classAbstractCacheView<T extends ISnowflake & Comparable<? super T>>
- Returns:
- Parallel Stream of elements
-
iterator
- Specified by:
iterator
in interfaceIterable<T extends ISnowflake & Comparable<? super T>>
- Overrides:
iterator
in classAbstractCacheView<T extends ISnowflake & Comparable<? super T>>
-