Interface RScoredSortedSet<V>
-
- Type Parameters:
V
- object type
- All Superinterfaces:
<V>
,<V>>
,<V>>
- All Known Subinterfaces:
RGeo<V>
- All Known Implementing Classes:
RedissonGeo
,RedissonLexSortedSet
,RedissonScoredSortedSet
public interface RScoredSortedSet<V> extends <V>, <V>>
Set containing elements sorted by score.- Author:
- Nikita Koksharov
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
RScoredSortedSet.Aggregate
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
add(double score, V object)
Adds element to this set, overrides previous score if it has been already added.int
<> objects)
Adds all elements contained in the specified map to this sorted set.addAndGetRank(double score, V object)
Adds element to this set, overrides previous score if it has been already added.addAndGetRevRank(double score, V object)
Adds element to this set, overrides previous score if it has been already added.<>
<? extends > map)
Adds elements to this set, overrides previous score if it has been already added.boolean
addIfExists(double score, V object)
Adds element to this set only if it's already exists.boolean
addIfGreater(double score, V object)
Adds element to this set only if new score greater than current score of existed element.boolean
addIfLess(double score, V object)
Adds element to this set only if new score less than current score of existed element.addScore(V element, value)
Increases score of specified element by value.addScoreAndGetRank(V object, value)
Adds score to element and returns its rankaddScoreAndGetRevRank(V object, value)
Adds score to element and returns its reverse rankvoid
clear()
Removes all elements of this sorted set.boolean
o)
Returnstrue
if this sorted set contains encoded state of the specified element.boolean
<?> c)
Returnstrue
if this sorted set contains all of the elements in encoded state in the specified collection.int
count(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns the number of elements with a score betweenstartScore
andendScore
.int
... names)
Diff provided ScoredSortedSets and store result to current ScoredSortedSet<ScoredEntry<V>>
entryRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns all entries (value and its score) betweenstartScore
andendScore
.<ScoredEntry<V>>
entryRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Returns all entries (value and its score) betweenstartScore
andendScore
.<ScoredEntry<V>>
entryRange(int startIndex, int endIndex)
Returns entries (value and its score) by rank range.<ScoredEntry<V>>
entryRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns all entries (value and its score) betweenstartScore
andendScore
in reversed order.<ScoredEntry<V>>
entryRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Returns all entries (value and its score) betweenstartScore
andendScore
in reversed order.<ScoredEntry<V>>
entryRangeReversed(int startIndex, int endIndex)
Returns entries (value and its score) by rank range in reverse order.V
first()
Returns the head element ornull
if this sorted set is empty.firstScore()
Returns score of the tail element or returnsnull
if this sorted set is empty.<>
<V> elements)
Returns scores of elements.getScore(V o)
Returns score of element ornull
if it doesn't exist.int
... names)
Intersect provided ScoredSortedSets and store result to current ScoredSortedSetint
<,> nameWithWeight)
Intersect provided ScoredSortedSets mapped to weight multiplier and store result to current ScoredSortedSetint
intersection(RScoredSortedSet.Aggregate aggregate, ... names)
Intersect provided ScoredSortedSets with defined aggregation method and store result to current ScoredSortedSetint
intersection(RScoredSortedSet.Aggregate aggregate, <,> nameWithWeight)
Intersect provided ScoredSortedSets mapped to weight multiplier with defined aggregation method and store result to current ScoredSortedSetboolean
isEmpty()
Returnstrue
if this set is empty<V>
iterator(int count)
Returns an iterator over elements in this set.<V>
pattern)
Returns an iterator over elements in this set.<V>
pattern, int count)
Returns an iterator over elements in this set.V
last()
Returns the tail element ornull
if this sorted set is empty.lastScore()
Returns score of the head element or returnsnull
if this sorted set is empty.<KOut,VOut>
RCollectionMapReduce<V,KOut,VOut>mapReduce()
ReturnsRMapReduce
object associated with this objectV
pollFirst()
Removes and returns the head element ornull
if this sorted set is empty.<V>
pollFirst(int count)
Removes and returns the head elements of this sorted set.V
pollFirst(long timeout, unit)
Removes and returns the head element ornull
if this sorted set is empty.V
pollFirstFromAny(long timeout, unit, ... queueNames)
Removes and returns first available head element of any sorted set, waiting up to the specified wait time if necessary for an element to become available in any of defined sorted sets including this one.V
pollLast()
Removes and returns the tail element ornull
if this sorted set is empty.<V>
pollLast(int count)
Removes and returns the tail elements of this sorted set.V
pollLast(long timeout, unit)
Removes and returns the tail element ornull
if this sorted set is empty.V
pollLastFromAny(long timeout, unit, ... queueNames)
Removes and returns first available tail element of any sorted set, waiting up to the specified wait time if necessary for an element to become available in any of defined sorted sets including this one.V
random()
Returns random element from this sorted set<V>
random(int count)
Returns random elements from this sorted set limited bycount
<>
randomEntries(int count)
Returns random entries from this sorted set limited bycount
.int
destName, double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Stores to defined ScoredSortedSet values betweenstartScore
andendScore
.int
destName, double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Stores to defined ScoredSortedSet values betweenstartScore
andendScore
.int
destName, int startIndex, int endIndex)
Stores to defined ScoredSortedSet values by rank range.rank(V o)
Returns rank of value, with the scores ordered from low to high.<V>
readAll()
Read all values at once.<V>
... names)
Diff ScoredSortedSets specified by name with current ScoredSortedSet without state change.<V>
... names)
Intersect provided ScoredSortedSets with current ScoredSortedSet without state change<V>
<,> nameWithWeight)
Intersect provided ScoredSortedSets mapped to weight multiplier with current ScoredSortedSet without state change<V>
readIntersection(RScoredSortedSet.Aggregate aggregate, ... names)
Intersect provided ScoredSortedSets with current ScoredSortedSet using defined aggregation method without state change<V>
readIntersection(RScoredSortedSet.Aggregate aggregate, <,> nameWithWeight)
Intersect provided ScoredSortedSets mapped to weight multiplier with current ScoredSortedSet using defined aggregation method without state change<V>
... names)
Union ScoredSortedSets specified by name with current ScoredSortedSet without state change.<V>
<,> nameWithWeight)
Union provided ScoredSortedSets mapped to weight multiplier and current ScoredSortedSet without state change.<V>
readUnion(RScoredSortedSet.Aggregate aggregate, ... names)
Union ScoredSortedSets specified by name with defined aggregation method and current ScoredSortedSet without state change.<V>
readUnion(RScoredSortedSet.Aggregate aggregate, <,> nameWithWeight)
Union provided ScoredSortedSets mapped to weight multiplier with defined aggregation method and current ScoredSortedSet without state changeboolean
o)
Removes a single instance of the specified element from this sorted set, if it is present.boolean
<?> c)
Removes all of this sorted set's elements that are also contained in the specified collection.int
removeRangeByRank(int startIndex, int endIndex)
Removes values by rank range.int
removeRangeByScore(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Removes values by score range.boolean
<?> c)
Retains only the elements in this sorted set that are contained in the specified collection.int
destName, double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Stores to defined ScoredSortedSet values in reversed order betweenstartScore
andendScore
.int
destName, double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Stores to defined ScoredSortedSet values in reversed order betweenstartScore
andendScore
.int
destName, int startIndex, int endIndex)
Stores to defined ScoredSortedSet values in reversed order by rank range.<>
<V> elements)
Returns ranks of elements, with the scores ordered from high to low.revRank(V o)
Returns rank of value, with the scores ordered from high to low.int
size()
Returns size of this set.<V>
stream()
Returns stream of elements in this set.<V>
stream(int count)
Returns stream of elements in this set.<V>
pattern)
Returns stream of elements in this set.<V>
pattern, int count)
Returns stream of elements in this set.int
<V> consumer)
Subscribes on first elements appeared in this set.int
<V> consumer)
Subscribes on last elements appeared in this set.V
takeFirst()
Removes and returns the head element waiting if necessary for an element to become available.V
takeLast()
Removes and returns the tail element waiting if necessary for an element to become available.[]
toArray()
Returns this sorted set in array of Object type.<T> T[]
toArray(T[] a)
Returns this sorted set in array of defined type.boolean
tryAdd(double score, V object)
Adds element to this set only if has not been added before.int
... names)
Union provided ScoredSortedSets and store result to current ScoredSortedSetint
<,> nameWithWeight)
Union provided ScoredSortedSets mapped to weight multiplier and store result to current ScoredSortedSetint
union(RScoredSortedSet.Aggregate aggregate, ... names)
Union provided ScoredSortedSets with defined aggregation method and store result to current ScoredSortedSetint
union(RScoredSortedSet.Aggregate aggregate, <,> nameWithWeight)
Union provided ScoredSortedSets mapped to weight multiplier with defined aggregation method and store result to current ScoredSortedSetvoid
unsubscribe(int listenerId)
Un-subscribes defined listener.<V>
valueRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns all values betweenstartScore
andendScore
.<V>
valueRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Returns all values betweenstartScore
andendScore
.<V>
valueRange(int startIndex, int endIndex)
Returns values by rank range.<V>
valueRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns all values betweenstartScore
andendScore
in reversed order.<V>
valueRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Returns all values betweenstartScore
andendScore
in reversed order.<V>
valueRangeReversed(int startIndex, int endIndex)
Returns values by rank range in reverse order.-
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RObject
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Methods inherited from interface org.redisson.api.RScoredSortedSetAsync
addAllAsync, addAndGetRankAsync, addAndGetRevRankAsync, addAndGetRevRankAsync, addAsync, addIfExistsAsync, addIfGreaterAsync, addIfLessAsync, addScoreAndGetRankAsync, addScoreAndGetRevRankAsync, addScoreAsync, containsAllAsync, containsAsync, countAsync, diffAsync, entryRangeAsync, entryRangeAsync, entryRangeAsync, entryRangeReversedAsync, entryRangeReversedAsync, entryRangeReversedAsync, firstAsync, firstScoreAsync, getScoreAsync, getScoreAsync, intersectionAsync, intersectionAsync, intersectionAsync, intersectionAsync, lastAsync, lastScoreAsync, pollFirstAsync, pollFirstAsync, pollFirstAsync, pollFirstFromAnyAsync, pollLastAsync, pollLastAsync, pollLastAsync, pollLastFromAnyAsync, randomAsync, randomAsync, randomEntriesAsync, rangeToAsync, rangeToAsync, rangeToAsync, rankAsync, readAllAsync, readDiffAsync, readIntersectionAsync, readIntersectionAsync, readIntersectionAsync, readIntersectionAsync, readUnionAsync, readUnionAsync, readUnionAsync, readUnionAsync, removeAllAsync, removeAsync, removeRangeByRankAsync, removeRangeByScoreAsync, retainAllAsync, revRangeToAsync, revRangeToAsync, revRangeToAsync, revRankAsync, revRankAsync, sizeAsync, takeFirstAsync, takeLastAsync, tryAddAsync, unionAsync, unionAsync, unionAsync, unionAsync, valueRangeAsync, valueRangeAsync, valueRangeAsync, valueRangeReversedAsync, valueRangeReversedAsync, valueRangeReversedAsync
-
Methods inherited from interface org.redisson.api.RSortable
readSort, readSort, readSort, readSort, readSort, readSort, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, sortTo, sortTo, sortTo, sortTo, sortTo, sortTo
-
Methods inherited from interface org.redisson.api.RSortableAsync
readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync
-
-
-
-
Method Detail
-
mapReduce
<KOut,VOut> RCollectionMapReduce<V,KOut,VOut> mapReduce()
ReturnsRMapReduce
object associated with this object- Type Parameters:
KOut
- output keyVOut
- output value- Returns:
- MapReduce instance
-
pollLastFromAny
V pollLastFromAny(long timeout, unit, ... queueNames)
Removes and returns first available tail element of any sorted set, waiting up to the specified wait time if necessary for an element to become available in any of defined sorted sets including this one.Requires Redis 5.0.0 and higher.
- Parameters:
queueNames
- - names of queuetimeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter- Returns:
- the tail element, or
null
if all sorted sets are empty
-
pollFirstFromAny
V pollFirstFromAny(long timeout, unit, ... queueNames)
Removes and returns first available head element of any sorted set, waiting up to the specified wait time if necessary for an element to become available in any of defined sorted sets including this one.Requires Redis 5.0.0 and higher.
- Parameters:
queueNames
- - names of queuetimeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter- Returns:
- the head element, or
null
if all sorted sets are empty
-
takeFirst
V takeFirst()
Removes and returns the head element waiting if necessary for an element to become available.- Returns:
- the head element
-
takeLast
V takeLast()
Removes and returns the tail element waiting if necessary for an element to become available.- Returns:
- the tail element
-
subscribeOnFirstElements
int subscribeOnFirstElements(<V> consumer)
Subscribes on first elements appeared in this set. Continuously invokesRScoredSortedSetAsync.takeFirstAsync()
method to get a new element.- Parameters:
consumer
- - queue elements listener- Returns:
- listenerId - id of listener
-
subscribeOnLastElements
int subscribeOnLastElements(<V> consumer)
Subscribes on last elements appeared in this set. Continuously invokesRScoredSortedSetAsync.takeLastAsync()
method to get a new element.- Parameters:
consumer
- - queue elements listener- Returns:
- listenerId - id of listener
-
unsubscribe
void unsubscribe(int listenerId)
Un-subscribes defined listener.- Parameters:
listenerId
- - id of listener
-
pollFirst
V pollFirst(long timeout, unit)
Removes and returns the head element ornull
if this sorted set is empty.- Parameters:
timeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter- Returns:
- the head element,
or
null
if this sorted set is empty
-
pollLast
V pollLast(long timeout, unit)
Removes and returns the tail element ornull
if this sorted set is empty.- Parameters:
timeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter- Returns:
- the tail element or
null
if this sorted set is empty
-
pollFirst
<V> pollFirst(int count)
Removes and returns the head elements of this sorted set.- Parameters:
count
- - elements amount- Returns:
- the head elements of this sorted set
-
pollLast
<V> pollLast(int count)
Removes and returns the tail elements of this sorted set.- Parameters:
count
- - elements amount- Returns:
- the tail elements of this sorted set
-
pollFirst
V pollFirst()
Removes and returns the head element ornull
if this sorted set is empty.- Returns:
- the head element,
or
null
if this sorted set is empty
-
pollLast
V pollLast()
Removes and returns the tail element ornull
if this sorted set is empty.- Returns:
- the tail element or
null
if this sorted set is empty
-
first
V first()
Returns the head element ornull
if this sorted set is empty.- Returns:
- the head element or
null
if this sorted set is empty
-
last
V last()
Returns the tail element ornull
if this sorted set is empty.- Returns:
- the tail element or
null
if this sorted set is empty
-
firstScore
firstScore()
Returns score of the tail element or returnsnull
if this sorted set is empty.- Returns:
- the tail element or
null
if this sorted set is empty
-
lastScore
lastScore()
Returns score of the head element or returnsnull
if this sorted set is empty.- Returns:
- the tail element or
null
if this sorted set is empty
-
random
V random()
Returns random element from this sorted setRequires Redis 6.2.0 and higher.
- Returns:
- random element
-
random
<V> random(int count)
Returns random elements from this sorted set limited bycount
Requires Redis 6.2.0 and higher.
- Parameters:
count
- - values amount to return- Returns:
- random elements
-
randomEntries
<> randomEntries(int count)
Returns random entries from this sorted set limited bycount
. Each map entry uses element as key and score as value.Requires Redis 6.2.0 and higher.
- Parameters:
count
- - entries amount to return- Returns:
- random entries
-
addAll
int addAll(<> objects)
Adds all elements contained in the specified map to this sorted set. Map contains of score mapped by object.- Parameters:
objects
- - map of elements to add- Returns:
- amount of added elements, not including already existing in this sorted set
-
removeRangeByScore
int removeRangeByScore(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Removes values by score range.- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusive- Returns:
- number of elements removed
-
removeRangeByRank
int removeRangeByRank(int startIndex, int endIndex)
Removes values by rank range. Indexes are zero based.-1
means the highest score,-2
means the second highest score.- Parameters:
startIndex
- - start indexendIndex
- - end index- Returns:
- number of elements removed
-
rank
rank(V o)
Returns rank of value, with the scores ordered from low to high.- Parameters:
o
- - object- Returns:
- rank or
null
if value does not exist
-
revRank
revRank(V o)
Returns rank of value, with the scores ordered from high to low.- Parameters:
o
- - object- Returns:
- rank or
null
if value does not exist
-
revRank
<> revRank(<V> elements)
Returns ranks of elements, with the scores ordered from high to low.- Parameters:
elements
- - elements- Returns:
- ranks or
null
if value does not exist
-
getScore
getScore(V o)
Returns score of element ornull
if it doesn't exist.- Parameters:
o
- - element- Returns:
- score
-
getScore
<> getScore(<V> elements)
Returns scores of elements.- Parameters:
elements
- - elements- Returns:
- element scores
-
add
boolean add(double score, V object)
Adds element to this set, overrides previous score if it has been already added.- Parameters:
score
- - object scoreobject
- - object itself- Returns:
true
if element has added andfalse
if not.
-
addAndGetRank
addAndGetRank(double score, V object)
Adds element to this set, overrides previous score if it has been already added. Finally return the rank of the item- Parameters:
score
- - object scoreobject
- - object itself- Returns:
- rank
-
addAndGetRevRank
addAndGetRevRank(double score, V object)
Adds element to this set, overrides previous score if it has been already added. Finally return the reverse rank of the item- Parameters:
score
- - object scoreobject
- - object itself- Returns:
- reverse rank
-
addAndGetRevRank
<> addAndGetRevRank(<? extends > map)
Adds elements to this set, overrides previous score if it has been already added. Finally returns reverse rank list of the items- Parameters:
map
- - map of object and scores, make sure to use an ordered map- Returns:
- collection of reverse ranks
-
tryAdd
boolean tryAdd(double score, V object)
Adds element to this set only if has not been added before.Requires Redis 3.0.2 and higher.
- Parameters:
score
- - object scoreobject
- - object itself- Returns:
true
if element added andfalse
if not.
-
addIfExists
boolean addIfExists(double score, V object)
Adds element to this set only if it's already exists.Requires Redis 3.0.2 and higher.
- Parameters:
score
- - object scoreobject
- - object itself- Returns:
true
if element added andfalse
if not.
-
addIfLess
boolean addIfLess(double score, V object)
Adds element to this set only if new score less than current score of existed element.Requires Redis 6.2.0 and higher.
- Parameters:
score
- - object scoreobject
- - object itself- Returns:
true
if element added andfalse
if not.
-
addIfGreater
boolean addIfGreater(double score, V object)
Adds element to this set only if new score greater than current score of existed element.Requires Redis 6.2.0 and higher.
- Parameters:
score
- - object scoreobject
- - object itself- Returns:
true
if element added andfalse
if not.
-
size
int size()
Returns size of this set.- Returns:
- size
-
isEmpty
boolean isEmpty()
Returnstrue
if this set is empty- Returns:
true
if empty
-
stream
<V> stream()
Returns stream of elements in this set. Elements are loaded in batch. Batch size is 10.- Returns:
- stream of elements
-
stream
< pattern)
Returns stream of elements in this set. Ifpattern
is not null then only elements match this pattern are loaded.- Parameters:
pattern
- - search pattern- Returns:
- stream of elements
-
stream
<V> stream(int count)
Returns stream of elements in this set. Elements are loaded in batch. Batch size is defined bycount
param.- Parameters:
count
- - size of elements batch- Returns:
- stream of elements
-
stream
< pattern, int count)
Returns stream of elements in this set. Elements are loaded in batch. Batch size is defined bycount
param. If pattern is not null then only elements match this pattern are loaded.- Parameters:
pattern
- - search patterncount
- - size of elements batch- Returns:
- stream of elements
-
iterator
< pattern)
Returns an iterator over elements in this set. Ifpattern
is not null then only elements match this pattern are loaded.- Parameters:
pattern
- - search pattern- Returns:
- iterator
-
iterator
<V> iterator(int count)
Returns an iterator over elements in this set. Elements are loaded in batch. Batch size is defined bycount
param.- Parameters:
count
- - size of elements batch- Returns:
- iterator
-
iterator
< pattern, int count)
Returns an iterator over elements in this set. Elements are loaded in batch. Batch size is defined bycount
param. If pattern is not null then only elements match this pattern are loaded.- Parameters:
pattern
- - search patterncount
- - size of elements batch- Returns:
- iterator
-
contains
boolean contains( o)
Returnstrue
if this sorted set contains encoded state of the specified element.- Parameters:
o
- element whose presence in this collection is to be tested- Returns:
true
if this sorted set contains the specified element andfalse
otherwise
-
toArray
[] toArray()
Returns this sorted set in array of Object type.- Returns:
- array of values
-
toArray
<T> T[] toArray(T[] a)
Returns this sorted set in array of defined type.- Type Parameters:
T
- type of element- Parameters:
a
- - instance of array- Returns:
- array of values
-
remove
boolean remove( o)
Removes a single instance of the specified element from this sorted set, if it is present.- Parameters:
o
- element to be removed from this sorted set, if present- Returns:
true
if an element was removed as a result of this call
-
containsAll
boolean containsAll(<?> c)
Returnstrue
if this sorted set contains all of the elements in encoded state in the specified collection.- Parameters:
c
- collection to be checked for containment in this sorted set- Returns:
true
if this sorted set contains all of the elements in the specified collection
-
removeAll
boolean removeAll(<?> c)
Removes all of this sorted set's elements that are also contained in the specified collection.- Parameters:
c
- collection containing elements to be removed from this collection- Returns:
true
if this sorted set changed as a result of the call
-
retainAll
boolean retainAll(<?> c)
Retains only the elements in this sorted set that are contained in the specified collection.- Parameters:
c
- collection containing elements to be retained in this collection- Returns:
true
if this sorted set changed as a result of the call
-
clear
void clear()
Removes all elements of this sorted set.
-
addScore
addScore(V element, value)
Increases score of specified element by value.- Parameters:
element
- - element whose score needs to be increasedvalue
- - value- Returns:
- updated score of element
-
addScoreAndGetRank
addScoreAndGetRank(V object, value)
Adds score to element and returns its rank- Parameters:
object
- - object itselfvalue
- - object score- Returns:
- rank
-
addScoreAndGetRevRank
addScoreAndGetRevRank(V object, value)
Adds score to element and returns its reverse rank- Parameters:
object
- - object itselfvalue
- - object score- Returns:
- reverse rank
-
rangeTo
int rangeTo( destName, int startIndex, int endIndex)
Stores to defined ScoredSortedSet values by rank range. Indexes are zero based.-1
means the highest score,-2
means the second highest score.Requires Redis 6.2.0 and higher.
- Parameters:
startIndex
- - start indexendIndex
- - end index- Returns:
- elements
-
rangeTo
int rangeTo( destName, double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Stores to defined ScoredSortedSet values betweenstartScore
andendScore
.Requires Redis 6.2.0 and higher.
- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusive- Returns:
- values
-
rangeTo
int rangeTo( destName, double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Stores to defined ScoredSortedSet values betweenstartScore
andendScore
.Requires Redis 6.2.0 and higher.
- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusiveoffset
- - offset of sorted datacount
- - amount of sorted data- Returns:
- values
-
revRangeTo
int revRangeTo( destName, int startIndex, int endIndex)
Stores to defined ScoredSortedSet values in reversed order by rank range. Indexes are zero based.-1
means the highest score,-2
means the second highest score.Requires Redis 6.2.0 and higher.
- Parameters:
startIndex
- - start indexendIndex
- - end index- Returns:
- elements
-
revRangeTo
int revRangeTo( destName, double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Stores to defined ScoredSortedSet values in reversed order betweenstartScore
andendScore
.Requires Redis 6.2.0 and higher.
- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusive- Returns:
- values
-
revRangeTo
int revRangeTo( destName, double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Stores to defined ScoredSortedSet values in reversed order betweenstartScore
andendScore
.Requires Redis 6.2.0 and higher.
- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusiveoffset
- - offset of sorted datacount
- - amount of sorted data- Returns:
- values
-
valueRange
<V> valueRange(int startIndex, int endIndex)
Returns values by rank range. Indexes are zero based.-1
means the highest score,-2
means the second highest score.- Parameters:
startIndex
- - start indexendIndex
- - end index- Returns:
- elements
-
valueRangeReversed
<V> valueRangeReversed(int startIndex, int endIndex)
Returns values by rank range in reverse order. Indexes are zero based.-1
means the highest score,-2
means the second highest score.- Parameters:
startIndex
- - start indexendIndex
- - end index- Returns:
- elements
-
entryRange
<ScoredEntry<V>> entryRange(int startIndex, int endIndex)
Returns entries (value and its score) by rank range. Indexes are zero based.-1
means the highest score,-2
means the second highest score.- Parameters:
startIndex
- - start indexendIndex
- - end index- Returns:
- entries
-
entryRangeReversed
<ScoredEntry<V>> entryRangeReversed(int startIndex, int endIndex)
Returns entries (value and its score) by rank range in reverse order. Indexes are zero based.-1
means the highest score,-2
means the second highest score.- Parameters:
startIndex
- - start indexendIndex
- - end index- Returns:
- entries
-
valueRange
<V> valueRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns all values betweenstartScore
andendScore
.- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusive- Returns:
- values
-
valueRangeReversed
<V> valueRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns all values betweenstartScore
andendScore
in reversed order.- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusive- Returns:
- values
-
entryRange
<ScoredEntry<V>> entryRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns all entries (value and its score) betweenstartScore
andendScore
.- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusive- Returns:
- entries
-
valueRange
<V> valueRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Returns all values betweenstartScore
andendScore
.- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusiveoffset
- - offset of sorted datacount
- - amount of sorted data- Returns:
- values
-
valueRangeReversed
<V> valueRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Returns all values betweenstartScore
andendScore
in reversed order.- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusiveoffset
- - offset of sorted datacount
- - amount of sorted data- Returns:
- values
-
entryRange
<ScoredEntry<V>> entryRange(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Returns all entries (value and its score) betweenstartScore
andendScore
.- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusiveoffset
- - offset of sorted datacount
- - amount of sorted data- Returns:
- entries
-
entryRangeReversed
<ScoredEntry<V>> entryRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns all entries (value and its score) betweenstartScore
andendScore
in reversed order.- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusive- Returns:
- entries
-
entryRangeReversed
<ScoredEntry<V>> entryRangeReversed(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive, int offset, int count)
Returns all entries (value and its score) betweenstartScore
andendScore
in reversed order.- Parameters:
startScore
- - start score. UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersstartScoreInclusive
- - start score inclusiveendScore
- - end score UseDouble.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
to define infinity numbersendScoreInclusive
- - end score inclusiveoffset
- - offset of sorted datacount
- - amount of sorted data- Returns:
- entries
-
count
int count(double startScore, boolean startScoreInclusive, double endScore, boolean endScoreInclusive)
Returns the number of elements with a score betweenstartScore
andendScore
.- Parameters:
startScore
- - start scorestartScoreInclusive
- - start score inclusiveendScore
- - end scoreendScoreInclusive
- - end score inclusive- Returns:
- count of elements
-
readAll
<V> readAll()
Read all values at once.- Returns:
- values
-
intersection
int intersection(... names)
Intersect provided ScoredSortedSets and store result to current ScoredSortedSet- Parameters:
names
- - names of ScoredSortedSet- Returns:
- length of intersection
-
intersection
int intersection(RScoredSortedSet.Aggregate aggregate, ... names)
Intersect provided ScoredSortedSets with defined aggregation method and store result to current ScoredSortedSet- Parameters:
aggregate
- - score aggregation modenames
- - names of ScoredSortedSet- Returns:
- length of intersection
-
intersection
int intersection(<,> nameWithWeight)
Intersect provided ScoredSortedSets mapped to weight multiplier and store result to current ScoredSortedSet- Parameters:
nameWithWeight
- - name of ScoredSortedSet mapped to weight multiplier- Returns:
- length of intersection
-
intersection
int intersection(RScoredSortedSet.Aggregate aggregate, <,> nameWithWeight)
Intersect provided ScoredSortedSets mapped to weight multiplier with defined aggregation method and store result to current ScoredSortedSet- Parameters:
aggregate
- - score aggregation modenameWithWeight
- - name of ScoredSortedSet mapped to weight multiplier- Returns:
- length of intersection
-
readIntersection
<... names)
Intersect provided ScoredSortedSets with current ScoredSortedSet without state changeRequires Redis 6.2.0 and higher.
- Parameters:
names
- - names of ScoredSortedSet- Returns:
- result of intersection
-
readIntersection
<V> readIntersection(RScoredSortedSet.Aggregate aggregate, ... names)
Intersect provided ScoredSortedSets with current ScoredSortedSet using defined aggregation method without state changeRequires Redis 6.2.0 and higher.
- Parameters:
aggregate
- - score aggregation modenames
- - names of ScoredSortedSet- Returns:
- result of intersection
-
readIntersection
<<,> nameWithWeight)
Intersect provided ScoredSortedSets mapped to weight multiplier with current ScoredSortedSet without state changeRequires Redis 6.2.0 and higher.
- Parameters:
nameWithWeight
- - name of ScoredSortedSet mapped to weight multiplier- Returns:
- result of intersection
-
readIntersection
<V> readIntersection(RScoredSortedSet.Aggregate aggregate, <,> nameWithWeight)
Intersect provided ScoredSortedSets mapped to weight multiplier with current ScoredSortedSet using defined aggregation method without state changeRequires Redis 6.2.0 and higher.
- Parameters:
aggregate
- - score aggregation modenameWithWeight
- - name of ScoredSortedSet mapped to weight multiplier- Returns:
- result of intersection
-
union
int union(... names)
Union provided ScoredSortedSets and store result to current ScoredSortedSet- Parameters:
names
- - names of ScoredSortedSet- Returns:
- length of union
-
union
int union(RScoredSortedSet.Aggregate aggregate, ... names)
Union provided ScoredSortedSets with defined aggregation method and store result to current ScoredSortedSet- Parameters:
aggregate
- - score aggregation modenames
- - names of ScoredSortedSet- Returns:
- length of union
-
union
int union(<,> nameWithWeight)
Union provided ScoredSortedSets mapped to weight multiplier and store result to current ScoredSortedSet- Parameters:
nameWithWeight
- - name of ScoredSortedSet mapped to weight multiplier- Returns:
- length of union
-
union
int union(RScoredSortedSet.Aggregate aggregate, <,> nameWithWeight)
Union provided ScoredSortedSets mapped to weight multiplier with defined aggregation method and store result to current ScoredSortedSet- Parameters:
aggregate
- - score aggregation modenameWithWeight
- - name of ScoredSortedSet mapped to weight multiplier- Returns:
- length of union
-
readUnion
<... names)
Union ScoredSortedSets specified by name with current ScoredSortedSet without state change.Requires Redis 6.2.0 and higher.
- Parameters:
names
- - names of ScoredSortedSet- Returns:
- result of union
-
readUnion
<V> readUnion(RScoredSortedSet.Aggregate aggregate, ... names)
Union ScoredSortedSets specified by name with defined aggregation method and current ScoredSortedSet without state change.Requires Redis 6.2.0 and higher.
- Parameters:
aggregate
- - score aggregation modenames
- - names of ScoredSortedSet- Returns:
- result of union
-
readUnion
<<,> nameWithWeight)
Union provided ScoredSortedSets mapped to weight multiplier and current ScoredSortedSet without state change.Requires Redis 6.2.0 and higher.
- Parameters:
nameWithWeight
- - name of ScoredSortedSet mapped to weight multiplier- Returns:
- result of union
-
readUnion
<V> readUnion(RScoredSortedSet.Aggregate aggregate, <,> nameWithWeight)
Union provided ScoredSortedSets mapped to weight multiplier with defined aggregation method and current ScoredSortedSet without state changeRequires Redis 6.2.0 and higher.
- Parameters:
aggregate
- - score aggregation modenameWithWeight
- - name of ScoredSortedSet mapped to weight multiplier- Returns:
- result of union
-
readDiff
<... names)
Diff ScoredSortedSets specified by name with current ScoredSortedSet without state change.Requires Redis 6.2.0 and higher.
- Parameters:
names
- - name of sets- Returns:
- result of diff
-
diff
int diff(... names)
Diff provided ScoredSortedSets and store result to current ScoredSortedSetRequires Redis 6.2.0 and higher.
- Parameters:
names
- - name of sets- Returns:
- length of diff
-
-