public class DefaultRedisSet<E> extends AbstractRedisCollection<E> implements RedisSet<E>
RedisSet
. Note that the collection support works only with normal,
non-pipeline/multi-exec connections as it requires a reply to be sent right away.ENCODING
Constructor and Description |
---|
DefaultRedisSet(BoundSetOperations<String,E> boundOps)
Constructs a new
DefaultRedisSet instance. |
DefaultRedisSet(String key,
RedisOperations<String,E> operations)
Constructs a new
DefaultRedisSet instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
Set<E> |
diff(Collection<? extends RedisSet<?>> sets)
Diff this set and other
RedisSet s. |
Set<E> |
diff(RedisSet<?> set)
Diff this set and another
RedisSet . |
RedisSet<E> |
diffAndStore(Collection<? extends RedisSet<?>> sets,
String destKey)
|
RedisSet<E> |
diffAndStore(RedisSet<?> set,
String destKey)
|
DataType |
getType()
Returns the associated Redis type.
|
Set<E> |
intersect(Collection<? extends RedisSet<?>> sets)
Intersect this set and other
RedisSet s. |
Set<E> |
intersect(RedisSet<?> set)
Intersect this set and another
RedisSet . |
RedisSet<E> |
intersectAndStore(Collection<? extends RedisSet<?>> sets,
String destKey)
|
RedisSet<E> |
intersectAndStore(RedisSet<?> set,
String destKey)
|
Iterator<E> |
iterator() |
E |
randomValue()
Get random element from the set.
|
boolean |
remove(Object o) |
Cursor<E> |
scan() |
Cursor<E> |
scan(ScanOptions options) |
int |
size() |
Set<E> |
union(Collection<? extends RedisSet<?>> sets)
Union this set and other
RedisSet s. |
Set<E> |
union(RedisSet<?> set)
Union this set and another
RedisSet . |
RedisSet<E> |
unionAndStore(Collection<? extends RedisSet<?>> sets,
String destKey)
|
RedisSet<E> |
unionAndStore(RedisSet<?> set,
String destKey)
|
addAll, checkResult, equals, expire, expireAt, getExpire, getKey, getOperations, hashCode, persist, removeAll, rename, toString
isEmpty, retainAll, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getOperations
expire, expire, expireAt, expireAt, getExpire, getKey, persist, rename
addAll, equals, hashCode, isEmpty, removeAll, retainAll, spliterator, toArray, toArray
parallelStream, removeIf, stream
public DefaultRedisSet(String key, RedisOperations<String,E> operations)
DefaultRedisSet
instance.key
- Redis key of this set.operations
- RedisOperations
for the value type of this set.public DefaultRedisSet(BoundSetOperations<String,E> boundOps)
DefaultRedisSet
instance.boundOps
- BoundSetOperations
for the value type of this set.public Set<E> diff(RedisSet<?> set)
RedisSet
RedisSet
.public Set<E> diff(Collection<? extends RedisSet<?>> sets)
RedisSet
RedisSet
s.public RedisSet<E> diffAndStore(RedisSet<?> set, String destKey)
RedisSet
RedisSet
by diffing this sorted set and RedisSet
and store result in destination
destKey
.diffAndStore
in interface RedisSet<E>
set
- must not be null.destKey
- must not be null.RedisSet
pointing at destKey
.public RedisSet<E> diffAndStore(Collection<? extends RedisSet<?>> sets, String destKey)
RedisSet
RedisSet
by diffing this sorted set and the collection RedisSet
and store result in
destination destKey
.diffAndStore
in interface RedisSet<E>
sets
- must not be null.destKey
- must not be null.RedisSet
pointing at destKey
.public Set<E> intersect(RedisSet<?> set)
RedisSet
RedisSet
.public Set<E> intersect(Collection<? extends RedisSet<?>> sets)
RedisSet
RedisSet
s.public RedisSet<E> intersectAndStore(RedisSet<?> set, String destKey)
RedisSet
RedisSet
by intersecting this sorted set and RedisSet
and store result in destination
destKey
.intersectAndStore
in interface RedisSet<E>
set
- must not be null.destKey
- must not be null.RedisSet
pointing at destKey
public RedisSet<E> intersectAndStore(Collection<? extends RedisSet<?>> sets, String destKey)
RedisSet
RedisSet
by intersecting this sorted set and the collection RedisSet
and store result
in destination destKey
.intersectAndStore
in interface RedisSet<E>
sets
- must not be null.destKey
- must not be null.RedisSet
pointing at destKey
.public Set<E> union(RedisSet<?> set)
RedisSet
RedisSet
.public Set<E> union(Collection<? extends RedisSet<?>> sets)
RedisSet
RedisSet
s.public RedisSet<E> unionAndStore(RedisSet<?> set, String destKey)
RedisSet
RedisSet
by union this sorted set and RedisSet
and store result in destination
destKey
.unionAndStore
in interface RedisSet<E>
set
- must not be null.destKey
- must not be null.RedisSet
pointing at destKey
.public RedisSet<E> unionAndStore(Collection<? extends RedisSet<?>> sets, String destKey)
RedisSet
RedisSet
by union this sorted set and the collection RedisSet
and store result in
destination destKey
.unionAndStore
in interface RedisSet<E>
sets
- must not be null.destKey
- must not be null.RedisSet
pointing at destKey
.public E randomValue()
RedisSet
randomValue
in interface RedisSet<E>
public boolean add(E e)
add
in interface Collection<E>
add
in interface Set<E>
add
in class AbstractCollection<E>
public void clear()
clear
in interface Collection<E>
clear
in interface Set<E>
clear
in class AbstractCollection<E>
public boolean contains(Object o)
contains
in interface Collection<E>
contains
in interface Set<E>
contains
in class AbstractCollection<E>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<E>
containsAll
in interface Set<E>
containsAll
in class AbstractRedisCollection<E>
public boolean remove(Object o)
remove
in interface Collection<E>
remove
in interface Set<E>
remove
in class AbstractCollection<E>
public int size()
size
in interface Collection<E>
size
in interface Set<E>
size
in class AbstractCollection<E>
public DataType getType()
BoundKeyOperations
getType
in interface BoundKeyOperations<String>
public Cursor<E> scan(ScanOptions options)
options
- Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.