Class SortedChannelCacheViewImpl<T extends Channel & Comparable<? super T>>
java.lang.Object
net.dv8tion.jda.internal.utils.cache.ReadWriteLockCache<T>
net.dv8tion.jda.internal.utils.cache.ChannelCacheViewImpl<T>
net.dv8tion.jda.internal.utils.cache.SortedChannelCacheViewImpl<T>
- All Implemented Interfaces:
Iterable<T>
,CacheView<T>
,ChannelCacheView<T>
,SnowflakeCacheView<T>
,SortedChannelCacheView<T>
,SortedSnowflakeCacheView<T>
public class SortedChannelCacheViewImpl<T extends Channel & Comparable<? super T>>
extends ChannelCacheViewImpl<T>
implements SortedChannelCacheView<T>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Nested classes/interfaces inherited from class net.dv8tion.jda.internal.utils.cache.ChannelCacheViewImpl
ChannelCacheViewImpl.FilteredCacheView<C extends T>
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.utils.cache.CacheView
CacheView.SimpleCacheView<T>
-
Constructor Summary
Constructors -
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) Creates an immutable list of all elements matching the given name.iterator()
<C extends T>
SortedChannelCacheViewImpl<T>.SortedFilteredCacheView<C> Creates a decorator around this cache, filtered to only provide access to the given type.Behavior similar toCacheView.parallelStream()
which does not preserve order.Behavior similar toCacheView.stream()
which does not preserve order.Methods inherited from class net.dv8tion.jda.internal.utils.cache.ChannelCacheViewImpl
clear, getElementById, getElementById, getElementsByName, isEmpty, lockedIterator, parallelStream, put, remove, remove, removeIf, size, stream
Methods inherited from class net.dv8tion.jda.internal.utils.cache.ReadWriteLockCache
clearCachedLists, readLock, writeLock
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.dv8tion.jda.api.utils.cache.CacheView
acceptStream, applyStream, collect, getElementsByName, isEmpty, lockedIterator, parallelStream, size, stream
Methods inherited from interface net.dv8tion.jda.api.utils.cache.ChannelCacheView
getElementById, getElementById
Methods inherited from interface net.dv8tion.jda.api.utils.cache.SnowflakeCacheView
getElementById, getElementById
-
Constructor Details
-
SortedChannelCacheViewImpl
-
-
Method Details
-
ofType
@Nonnull public <C extends T> SortedChannelCacheViewImpl<T>.SortedFilteredCacheView<C> ofType(@Nonnull Class<C> type) Description copied from interface:ChannelCacheView
Creates a decorator around this cache, filtered to only provide access to the given type.- Specified by:
ofType
in interfaceChannelCacheView<T extends Channel & Comparable<? super T>>
- Specified by:
ofType
in interfaceSortedChannelCacheView<T extends Channel & Comparable<? super T>>
- Overrides:
ofType
in classChannelCacheViewImpl<T extends Channel & Comparable<? super T>>
- Type Parameters:
C
- The type parameter- Parameters:
type
- The type class (LikeTextChannel.class
)- Returns:
- The filtered cache view
-
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 Channel & Comparable<? super T>>
- Overrides:
asList
in classChannelCacheViewImpl<T extends Channel & 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 Channel & Comparable<? super T>>
- Specified by:
asSet
in interfaceSortedSnowflakeCacheView<T extends Channel & Comparable<? super T>>
- Overrides:
asSet
in classChannelCacheViewImpl<T extends Channel & Comparable<? super T>>
- Returns:
- Immutable set of cached elements
-
forEachUnordered
Description copied from interface:CacheView
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 Channel & Comparable<? super T>>
- Specified by:
forEachUnordered
in interfaceSortedSnowflakeCacheView<T extends Channel & Comparable<? super T>>
- Parameters:
action
- The action to perform
-
forEach
- Specified by:
forEach
in interfaceIterable<T extends Channel & Comparable<? super T>>
- Overrides:
forEach
in classChannelCacheViewImpl<T extends Channel & Comparable<? super T>>
-
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 Channel & Comparable<? super T>>
- Parameters:
name
- The name to check- Returns:
- Immutable list of elements with the given name
-
streamUnordered
Description copied from interface:SortedSnowflakeCacheView
Behavior similar toCacheView.stream()
which does not preserve order.- Specified by:
streamUnordered
in interfaceSortedSnowflakeCacheView<T extends Channel & 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 Channel & Comparable<? super T>>
- Returns:
- (Parallel) Stream of contained elements
-
spliterator
- Specified by:
spliterator
in interfaceIterable<T extends Channel & Comparable<? super T>>
-
iterator
- Specified by:
iterator
in interfaceIterable<T extends Channel & Comparable<? super T>>
- Overrides:
iterator
in classChannelCacheViewImpl<T extends Channel & Comparable<? super T>>
-