From e258d827962f3d83fc23e4cb317fb286c7fb0978 Mon Sep 17 00:00:00 2001 From: Nikita Date: Fri, 12 Aug 2016 14:11:32 +0300 Subject: [PATCH] Deprecated methods removed --- .../org/redisson/RedissonLexSortedSet.java | 162 +++--------------- .../main/java/org/redisson/RedissonMap.java | 80 ++------- .../main/java/org/redisson/api/Predicate.java | 22 --- .../java/org/redisson/api/RLexSortedSet.java | 78 --------- .../org/redisson/api/RLexSortedSetAsync.java | 78 --------- .../src/main/java/org/redisson/api/RMap.java | 63 ++----- .../redisson/config/ClusterServersConfig.java | 16 -- .../main/java/org/redisson/config/Config.java | 24 +-- .../java/org/redisson/RedissonMapTest.java | 23 +-- .../redisson/RedissonScoredSortedSetTest.java | 4 +- 10 files changed, 54 insertions(+), 496 deletions(-) delete mode 100644 redisson/src/main/java/org/redisson/api/Predicate.java diff --git a/redisson/src/main/java/org/redisson/RedissonLexSortedSet.java b/redisson/src/main/java/org/redisson/RedissonLexSortedSet.java index 190e8a515..cc64e772b 100644 --- a/redisson/src/main/java/org/redisson/RedissonLexSortedSet.java +++ b/redisson/src/main/java/org/redisson/RedissonLexSortedSet.java @@ -33,271 +33,151 @@ public class RedissonLexSortedSet extends RedissonScoredSortedSet implem @Override public int removeRange(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive) { - return removeRangeByLex(fromElement, fromInclusive, toElement, toInclusive); - } - - @Override - public int removeRangeByLex(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive) { return get(removeRangeAsync(fromElement, fromInclusive, toElement, toInclusive)); } - - @Override - public int removeRangeHead(String toElement, boolean toInclusive) { - return removeRangeHeadByLex(toElement, toInclusive); - } @Override - public int removeRangeHeadByLex(String toElement, boolean toInclusive) { + public int removeRangeHead(String toElement, boolean toInclusive) { return get(removeRangeHeadAsync(toElement, toInclusive)); } - - @Override - public RFuture removeRangeHeadAsync(String toElement, boolean toInclusive) { - return removeRangeHeadByLexAsync(toElement, toInclusive); - } @Override - public RFuture removeRangeHeadByLexAsync(String toElement, boolean toInclusive) { + public RFuture removeRangeHeadAsync(String toElement, boolean toInclusive) { String toValue = value(toElement, toInclusive); return commandExecutor.writeAsync(getName(), StringCodec.INSTANCE, RedisCommands.ZREMRANGEBYLEX, getName(), "-", toValue); } @Override public int removeRangeTail(String fromElement, boolean fromInclusive) { - return removeRangeTailByLex(fromElement, fromInclusive); - } - - @Override - public int removeRangeTailByLex(String fromElement, boolean fromInclusive) { return get(removeRangeTailAsync(fromElement, fromInclusive)); } @Override public RFuture removeRangeTailAsync(String fromElement, boolean fromInclusive) { - return removeRangeTailByLexAsync(fromElement, fromInclusive); - } - - @Override - public RFuture removeRangeTailByLexAsync(String fromElement, boolean fromInclusive) { String fromValue = value(fromElement, fromInclusive); return commandExecutor.writeAsync(getName(), StringCodec.INSTANCE, RedisCommands.ZREMRANGEBYLEX, getName(), fromValue, "+"); } - + @Override public RFuture removeRangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive) { - return removeRangeByLexAsync(fromElement, fromInclusive, toElement, toInclusive); - } - - @Override - public RFuture removeRangeByLexAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive) { String fromValue = value(fromElement, fromInclusive); String toValue = value(toElement, toInclusive); - + return commandExecutor.writeAsync(getName(), StringCodec.INSTANCE, RedisCommands.ZREMRANGEBYLEX, getName(), fromValue, toValue); } - - @Override - public Collection range(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive) { - return lexRange(fromElement, fromInclusive, toElement, toInclusive); - } @Override - public Collection lexRange(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive) { + public Collection range(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive) { return get(rangeAsync(fromElement, fromInclusive, toElement, toInclusive)); } - - @Override - public Collection rangeHead(String toElement, boolean toInclusive) { - return lexRangeHead(toElement, toInclusive); - } @Override - public Collection lexRangeHead(String toElement, boolean toInclusive) { + public Collection rangeHead(String toElement, boolean toInclusive) { return get(rangeHeadAsync(toElement, toInclusive)); } - - @Override - public RFuture> rangeHeadAsync(String toElement, boolean toInclusive) { - return lexRangeHeadAsync(toElement, toInclusive); - } @Override - public RFuture> lexRangeHeadAsync(String toElement, boolean toInclusive) { + public RFuture> rangeHeadAsync(String toElement, boolean toInclusive) { String toValue = value(toElement, toInclusive); return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.ZRANGEBYLEX, getName(), "-", toValue); } @Override public Collection rangeTail(String fromElement, boolean fromInclusive) { - return lexRangeTail(fromElement, fromInclusive); - } - - @Override - public Collection lexRangeTail(String fromElement, boolean fromInclusive) { return get(rangeTailAsync(fromElement, fromInclusive)); } @Override public RFuture> rangeTailAsync(String fromElement, boolean fromInclusive) { - return lexRangeTailAsync(fromElement, fromInclusive); - } - - @Override - public RFuture> lexRangeTailAsync(String fromElement, boolean fromInclusive) { String fromValue = value(fromElement, fromInclusive); return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.ZRANGEBYLEX, getName(), fromValue, "+"); } - + @Override public RFuture> rangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive) { - return lexRangeAsync(fromElement, fromInclusive, toElement, toInclusive); - } - - @Override - public RFuture> lexRangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive) { String fromValue = value(fromElement, fromInclusive); String toValue = value(toElement, toInclusive); - + return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.ZRANGEBYLEX, getName(), fromValue, toValue); } @Override public Collection range(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count) { - return lexRange(fromElement, fromInclusive, toElement, toInclusive, offset, count); - } - - @Override - public Collection lexRange(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count) { return get(rangeAsync(fromElement, fromInclusive, toElement, toInclusive, offset, count)); } - - @Override - public Collection rangeHead(String toElement, boolean toInclusive, int offset, int count) { - return lexRangeHead(toElement, toInclusive, offset, count); - } @Override - public Collection lexRangeHead(String toElement, boolean toInclusive, int offset, int count) { + public Collection rangeHead(String toElement, boolean toInclusive, int offset, int count) { return get(rangeHeadAsync(toElement, toInclusive, offset, count)); } - - @Override - public RFuture> rangeHeadAsync(String toElement, boolean toInclusive, int offset, int count) { - return lexRangeHeadAsync(toElement, toInclusive, offset, count); - } @Override - public RFuture> lexRangeHeadAsync(String toElement, boolean toInclusive, int offset, int count) { + public RFuture> rangeHeadAsync(String toElement, boolean toInclusive, int offset, int count) { String toValue = value(toElement, toInclusive); return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.ZRANGEBYLEX, getName(), "-", toValue, "LIMIT", offset, count); } @Override public Collection rangeTail(String fromElement, boolean fromInclusive, int offset, int count) { - return lexRangeTail(fromElement, fromInclusive, offset, count); - } - - @Override - public Collection lexRangeTail(String fromElement, boolean fromInclusive, int offset, int count) { return get(rangeTailAsync(fromElement, fromInclusive, offset, count)); } - - @Override - public RFuture> rangeTailAsync(String fromElement, boolean fromInclusive, int offset, int count) { - return lexRangeTailAsync(fromElement, fromInclusive, offset, count); - } @Override - public RFuture> lexRangeTailAsync(String fromElement, boolean fromInclusive, int offset, int count) { + public RFuture> rangeTailAsync(String fromElement, boolean fromInclusive, int offset, int count) { String fromValue = value(fromElement, fromInclusive); return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.ZRANGEBYLEX, getName(), fromValue, "+", "LIMIT", offset, count); } - + @Override public RFuture> rangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count) { - return lexRangeAsync(fromElement, fromInclusive, toElement, toInclusive, offset, count); - } - - @Override - public RFuture> lexRangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count) { String fromValue = value(fromElement, fromInclusive); String toValue = value(toElement, toInclusive); - + return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.ZRANGEBYLEX, getName(), fromValue, toValue, "LIMIT", offset, count); } @Override public int countTail(String fromElement, boolean fromInclusive) { - return lexCountTail(fromElement, fromInclusive); - } - - @Override - public int lexCountTail(String fromElement, boolean fromInclusive) { return get(countTailAsync(fromElement, fromInclusive)); } @Override public RFuture countTailAsync(String fromElement, boolean fromInclusive) { - return lexCountTailAsync(fromElement, fromInclusive); - } - - @Override - public RFuture lexCountTailAsync(String fromElement, boolean fromInclusive) { String fromValue = value(fromElement, fromInclusive); - + return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.ZLEXCOUNT, getName(), fromValue, "+"); } - - @Override - public int countHead(String toElement, boolean toInclusive) { - return lexCountHead(toElement, toInclusive); - } @Override - public int lexCountHead(String toElement, boolean toInclusive) { + public int countHead(String toElement, boolean toInclusive) { return get(countHeadAsync(toElement, toInclusive)); } - - @Override - public RFuture countHeadAsync(String toElement, boolean toInclusive) { - return lexCountHeadAsync(toElement, toInclusive); - } @Override - public RFuture lexCountHeadAsync(String toElement, boolean toInclusive) { + public RFuture countHeadAsync(String toElement, boolean toInclusive) { String toValue = value(toElement, toInclusive); - + return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.ZLEXCOUNT, getName(), "-", toValue); } @Override public int count(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive) { - return lexCount(fromElement, fromInclusive, toElement, toInclusive); - } - - @Override - public int lexCount(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive) { return get(countAsync(fromElement, fromInclusive, toElement, toInclusive)); } - + @Override public RFuture countAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive) { - return lexCountAsync(fromElement, fromInclusive, toElement, toInclusive); - } - - @Override - public RFuture lexCountAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive) { String fromValue = value(fromElement, fromInclusive); String toValue = value(toElement, toInclusive); - + return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.ZLEXCOUNT, getName(), fromValue, toValue); } - + private String value(String fromElement, boolean fromInclusive) { String fromValue = fromElement.toString(); if (fromInclusive) { diff --git a/redisson/src/main/java/org/redisson/RedissonMap.java b/redisson/src/main/java/org/redisson/RedissonMap.java index fb7439f78..5765a31d3 100644 --- a/redisson/src/main/java/org/redisson/RedissonMap.java +++ b/redisson/src/main/java/org/redisson/RedissonMap.java @@ -24,13 +24,11 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; -import org.redisson.api.Predicate; import org.redisson.api.RFuture; import org.redisson.api.RMap; import org.redisson.client.codec.Codec; @@ -356,68 +354,6 @@ public class RedissonMap extends RedissonExpirable implements RMap { return get(f); } - @Override - public Iterator> entryIterator() { - return new RedissonMapIterator>(this); - } - - @Override - public Iterator valueIterator() { - return new RedissonMapIterator(this) { - @Override - V getValue(java.util.Map.Entry entry) { - return (V) entry.getValue().getObj(); - } - }; - } - - @Override - public Iterator keyIterator() { - return new RedissonMapIterator(this) { - @Override - K getValue(java.util.Map.Entry entry) { - return (K) entry.getKey().getObj(); - } - }; - } - - - @Override - public Map filterKeys(Predicate predicate) { - Map result = new HashMap(); - for (Iterator> iterator = entryIterator(); iterator.hasNext();) { - Map.Entry entry = iterator.next(); - if (predicate.apply(entry.getKey())) { - result.put(entry.getKey(), entry.getValue()); - } - } - return result; - } - - @Override - public Map filterValues(Predicate predicate) { - Map result = new HashMap(); - for (Iterator> iterator = entryIterator(); iterator.hasNext();) { - Map.Entry entry = iterator.next(); - if (predicate.apply(entry.getValue())) { - result.put(entry.getKey(), entry.getValue()); - } - } - return result; - } - - @Override - public Map filterEntries(Predicate> predicate) { - Map result = new HashMap(); - for (Iterator> iterator = entryIterator(); iterator.hasNext();) { - Map.Entry entry = iterator.next(); - if (predicate.apply(entry)) { - result.put(entry.getKey(), entry.getValue()); - } - } - return result; - } - @Override public V addAndGet(K key, Number value) { return get(addAndGetAsync(key, value)); @@ -482,7 +418,12 @@ public class RedissonMap extends RedissonExpirable implements RMap { @Override public Iterator iterator() { - return RedissonMap.this.keyIterator(); + return new RedissonMapIterator(RedissonMap.this) { + @Override + K getValue(java.util.Map.Entry entry) { + return (K) entry.getKey().getObj(); + } + }; } @Override @@ -511,7 +452,12 @@ public class RedissonMap extends RedissonExpirable implements RMap { @Override public Iterator iterator() { - return valueIterator(); + return new RedissonMapIterator(RedissonMap.this) { + @Override + V getValue(java.util.Map.Entry entry) { + return (V) entry.getValue().getObj(); + } + }; } @Override @@ -534,7 +480,7 @@ public class RedissonMap extends RedissonExpirable implements RMap { final class EntrySet extends AbstractSet> { public final Iterator> iterator() { - return entryIterator(); + return new RedissonMapIterator>(RedissonMap.this); } public final boolean contains(Object o) { diff --git a/redisson/src/main/java/org/redisson/api/Predicate.java b/redisson/src/main/java/org/redisson/api/Predicate.java deleted file mode 100644 index 878d3e3df..000000000 --- a/redisson/src/main/java/org/redisson/api/Predicate.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2016 Nikita Koksharov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.redisson.api; - -public interface Predicate { - - boolean apply(T input); - -} diff --git a/redisson/src/main/java/org/redisson/api/RLexSortedSet.java b/redisson/src/main/java/org/redisson/api/RLexSortedSet.java index f3f1287df..c1b8c7940 100644 --- a/redisson/src/main/java/org/redisson/api/RLexSortedSet.java +++ b/redisson/src/main/java/org/redisson/api/RLexSortedSet.java @@ -45,108 +45,30 @@ public interface RLexSortedSet extends RLexSortedSetAsync, Set, RExpirab int removeRangeTail(String fromElement, boolean fromInclusive); - /** - * Use {@link RLexSortedSet#removeRangeTail(String, boolean)} - */ - @Deprecated - int removeRangeTailByLex(String fromElement, boolean fromInclusive); - int removeRangeHead(String toElement, boolean toInclusive); - /** - * Use {@link RLexSortedSet#removeRangeHead(String, boolean)} - */ - @Deprecated - int removeRangeHeadByLex(String toElement, boolean toInclusive); - int removeRange(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); - /** - * Use {@link RLexSortedSet#removeRange(String, boolean)} - */ - @Deprecated - int removeRangeByLex(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); - int countTail(String fromElement, boolean fromInclusive); - /** - * Use {@link RLexSortedSet#countTail(String, boolean)} - */ - @Deprecated - int lexCountTail(String fromElement, boolean fromInclusive); - int countHead(String toElement, boolean toInclusive); - /** - * Use {@link RLexSortedSet#countHead(String, boolean)} - */ - @Deprecated - int lexCountHead(String toElement, boolean toInclusive); - Collection rangeTail(String fromElement, boolean fromInclusive); - /** - * Use {@link RLexSortedSet#rangeTail(String, boolean)} - */ - @Deprecated - Collection lexRangeTail(String fromElement, boolean fromInclusive); - Collection rangeHead(String toElement, boolean toInclusive); - /** - * Use {@link RLexSortedSet#rangeHead(String, boolean)} - */ - @Deprecated - Collection lexRangeHead(String toElement, boolean toInclusive); - Collection range(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); - /** - * Use {@link RLexSortedSet#range(String, boolean, String, boolean)} - */ - @Deprecated - Collection lexRange(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); - Collection rangeTail(String fromElement, boolean fromInclusive, int offset, int count); - /** - * Use {@link RLexSortedSet#rangeTail(String, boolean, int, int)} - */ - @Deprecated - Collection lexRangeTail(String fromElement, boolean fromInclusive, int offset, int count); - Collection rangeHead(String toElement, boolean toInclusive, int offset, int count); - /** - * Use {@link RLexSortedSet#rangeHead(String, boolean, int, int)} - */ - @Deprecated - Collection lexRangeHead(String toElement, boolean toInclusive, int offset, int count); - Collection range(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count); - /** - * Use {@link RLexSortedSet#range(String, boolean, String, boolean, int, int)} - */ - @Deprecated - Collection lexRange(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count); - int count(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); - /** - * Use {@link RLexSortedSet#count(String, boolean, String, boolean)} - */ - @Deprecated - int lexCount(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); - Integer rank(String o); Collection range(int startIndex, int endIndex); - /** - * Use {@link RLexSortedSet#range(int, int)} - */ - @Deprecated - Collection valueRange(int startIndex, int endIndex); - } diff --git a/redisson/src/main/java/org/redisson/api/RLexSortedSetAsync.java b/redisson/src/main/java/org/redisson/api/RLexSortedSetAsync.java index 4014a357c..181b28ea2 100644 --- a/redisson/src/main/java/org/redisson/api/RLexSortedSetAsync.java +++ b/redisson/src/main/java/org/redisson/api/RLexSortedSetAsync.java @@ -36,109 +36,31 @@ public interface RLexSortedSetAsync extends RCollectionAsync { RFuture removeRangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); - /** - * Use {@link RLexSortedSetAsync#removeRangeAsync(String, boolean, String, boolean)} - */ - @Deprecated - RFuture removeRangeByLexAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); - RFuture removeRangeTailAsync(String fromElement, boolean fromInclusive); - /** - * Use {@link RLexSortedSetAsync#removeRangeTailAsync(String, boolean, String, boolean)} - */ - @Deprecated - RFuture removeRangeTailByLexAsync(String fromElement, boolean fromInclusive); - RFuture removeRangeHeadAsync(String toElement, boolean toInclusive); - /** - * Use {@link RLexSortedSetAsync#removeRangeHeadAsync(String, boolean)} - */ - @Deprecated - RFuture removeRangeHeadByLexAsync(String toElement, boolean toInclusive); - RFuture countTailAsync(String fromElement, boolean fromInclusive); - /** - * Use {@link RLexSortedSetAsync#countTailAsync(String, boolean)} - */ - @Deprecated - RFuture lexCountTailAsync(String fromElement, boolean fromInclusive); - RFuture countHeadAsync(String toElement, boolean toInclusive); - /** - * Use {@link RLexSortedSetAsync#countHeadAsync(String, boolean)} - */ - @Deprecated - RFuture lexCountHeadAsync(String toElement, boolean toInclusive); - RFuture> rangeTailAsync(String fromElement, boolean fromInclusive); - /** - * Use {@link RLexSortedSetAsync#rangeTailAsync(String, boolean)} - */ - @Deprecated - RFuture> lexRangeTailAsync(String fromElement, boolean fromInclusive); - RFuture> rangeHeadAsync(String toElement, boolean toInclusive); - /** - * Use {@link RLexSortedSetAsync#rangeHeadAsync(String, boolean)} - */ - @Deprecated - RFuture> lexRangeHeadAsync(String toElement, boolean toInclusive); - RFuture> rangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); - /** - * Use {@link RLexSortedSetAsync#rangeAsync(String, boolean, String, boolean)} - */ - @Deprecated - RFuture> lexRangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); - RFuture> rangeTailAsync(String fromElement, boolean fromInclusive, int offset, int count); - /** - * Use {@link RLexSortedSetAsync#rangeTailAsync(String, boolean, int, int)} - */ - @Deprecated - RFuture> lexRangeTailAsync(String fromElement, boolean fromInclusive, int offset, int count); - RFuture> rangeHeadAsync(String toElement, boolean toInclusive, int offset, int count); - /** - * Use {@link RLexSortedSetAsync#rangeHeadAsync(String, boolean, int, int)} - */ - @Deprecated - RFuture> lexRangeHeadAsync(String toElement, boolean toInclusive, int offset, int count); - RFuture> rangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count); - /** - * Use {@link RLexSortedSetAsync#rangeAsync(String, boolean, String, boolean, int, int)} - */ - @Deprecated - RFuture> lexRangeAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive, int offset, int count); - RFuture countAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); - /** - * Use {@link RLexSortedSetAsync#countAsync(String, boolean, String, boolean)} - */ - @Deprecated - RFuture lexCountAsync(String fromElement, boolean fromInclusive, String toElement, boolean toInclusive); - RFuture rankAsync(String o); RFuture> rangeAsync(int startIndex, int endIndex); - - /** - * Use {@link RLexSortedSetAsync#rangeAsync(int, int)} - */ - @Deprecated - RFuture> valueRangeAsync(int startIndex, int endIndex); /** * Returns rank of value, with the scores ordered from high to low. diff --git a/redisson/src/main/java/org/redisson/api/RMap.java b/redisson/src/main/java/org/redisson/api/RMap.java index da5e82162..825123766 100644 --- a/redisson/src/main/java/org/redisson/api/RMap.java +++ b/redisson/src/main/java/org/redisson/api/RMap.java @@ -16,7 +16,6 @@ package org.redisson.api; import java.util.Collection; -import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentMap; @@ -58,42 +57,6 @@ public interface RMap extends ConcurrentMap, RExpirable, RMapAsync getAll(Set keys); - /** - * Returns a map slice containing the mappings in whose Map.Entry<K, V> entries - * satisfy a predicate. This operation traverses all map entries with small memory footprint. - * - * The returned map is NOT backed by the original map. - * - * @param predicate - * @return - */ - @Deprecated - Map filterEntries(Predicate> predicate); - - /** - * Returns a map slice containing the mappings in whose values - * satisfy a predicate. Traverses all map entries with small memory footprint. - * - * The returned map is NOT backed by the original map. - * - * @param predicate - * @return - */ - @Deprecated - Map filterValues(Predicate predicate); - - /** - * Returns a map slice containing the mappings in whose keys - * satisfy a predicate. Traverses all map entries with small memory footprint. - * - * The returned map is NOT backed by the original map. - * - * @param predicate - * @return - */ - @Deprecated - Map filterKeys(Predicate predicate); - /** * Removes keys from map by one operation * @@ -142,24 +105,24 @@ public interface RMap extends ConcurrentMap, RExpirable, RMapAsync> readAllEntrySet(); /** - * Use {@link #entrySet().iterator()} - * + * Returns key set. + * This method DOESN'T fetch all of them as {@link #readAllKeySet()} does. */ - @Deprecated - Iterator> entryIterator(); + @Override + Set keySet(); /** - * Use {@link #keySet().iterator()} - * + * Returns values collections. + * This method DOESN'T fetch all of them as {@link #readAllValues()} does. */ - @Deprecated - Iterator keyIterator(); + @Override + Collection values(); /** - * Use {@link #values().iterator()} - * + * Returns values collections. + * This method DOESN'T fetch all of them as {@link #readAllEntrySet()} does. */ - @Deprecated - Iterator valueIterator(); - + @Override + Set> entrySet(); + } diff --git a/redisson/src/main/java/org/redisson/config/ClusterServersConfig.java b/redisson/src/main/java/org/redisson/config/ClusterServersConfig.java index ecb0df62b..c4c74dd01 100644 --- a/redisson/src/main/java/org/redisson/config/ClusterServersConfig.java +++ b/redisson/src/main/java/org/redisson/config/ClusterServersConfig.java @@ -75,20 +75,4 @@ public class ClusterServersConfig extends BaseMasterSlaveServersConfig map = redisson.getMap("filterKeys"); - map.put(1, 100); - map.put(2, 200); - map.put(3, 300); - map.put(4, 400); - - Map filtered = map.filterKeys(input -> input >= 2 && input <= 3); - - Map expectedMap = new HashMap(); - expectedMap.put(2, 200); - expectedMap.put(3, 300); - assertThat(filtered).isEqualTo(expectedMap); - } - @Test public void testStringCodec() { Config config = createConfig(); @@ -661,7 +642,7 @@ public class RedissonMapTest extends BaseTest { Collection keys = map.keySet(); assertThat(keys).containsOnly(1, 3, 4, 7); - for (Iterator iterator = map.keyIterator(); iterator.hasNext();) { + for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) { Integer value = iterator.next(); if (!keys.remove(value)) { Assert.fail(); @@ -681,7 +662,7 @@ public class RedissonMapTest extends BaseTest { Collection values = map.values(); assertThat(values).containsOnly(0, 5, 6, 8); - for (Iterator iterator = map.valueIterator(); iterator.hasNext();) { + for (Iterator iterator = map.values().iterator(); iterator.hasNext();) { Integer value = iterator.next(); if (!values.remove(value)) { Assert.fail(); diff --git a/redisson/src/test/java/org/redisson/RedissonScoredSortedSetTest.java b/redisson/src/test/java/org/redisson/RedissonScoredSortedSetTest.java index d60ae0aa6..ca0a9aa61 100644 --- a/redisson/src/test/java/org/redisson/RedissonScoredSortedSetTest.java +++ b/redisson/src/test/java/org/redisson/RedissonScoredSortedSetTest.java @@ -14,6 +14,7 @@ import java.util.TreeSet; import java.util.concurrent.ExecutionException; import org.junit.Assert; +import org.junit.Assume; import org.junit.Test; import org.redisson.api.RLexSortedSet; import org.redisson.api.RScoredSortedSet; @@ -22,7 +23,6 @@ import org.redisson.client.codec.StringCodec; import org.redisson.client.protocol.ScoredEntry; import io.netty.util.concurrent.Future; -import org.junit.Assume; public class RedissonScoredSortedSetTest extends BaseTest { @@ -572,7 +572,7 @@ public class RedissonScoredSortedSetTest extends BaseTest { set.add("d"); set.add("e"); - Collection r = set.lexRange("b", true, "e", false, 1, 2); + Collection r = set.range("b", true, "e", false, 1, 2); String[] a = r.toArray(new String[0]); Assert.assertArrayEquals(new String[]{"c", "d"}, a); }