Keep RMap insertion ordering while iteration (backported)

2.2.x
Nikita 8 years ago
parent bce896d47b
commit 613584b8d9

@ -15,7 +15,7 @@
*/
package org.redisson.client.protocol.decoder;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -34,7 +34,7 @@ public class ObjectMapEntryReplayDecoder implements MultiDecoder<Set<Entry<Objec
@Override
public Set<Entry<Object, Object>> decode(List<Object> parts, State state) {
Map<Object, Object> result = new HashMap<Object, Object>(parts.size()/2);
Map<Object, Object> result = new LinkedHashMap<Object, Object>(parts.size()/2);
for (int i = 0; i < parts.size(); i++) {
if (i % 2 != 0) {
result.put(parts.get(i-1), parts.get(i));

@ -15,7 +15,7 @@
*/
package org.redisson.client.protocol.decoder;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -32,7 +32,7 @@ public class ObjectMapReplayDecoder implements MultiDecoder<Map<Object, Object>>
@Override
public Map<Object, Object> decode(List<Object> parts, State state) {
Map<Object, Object> result = new HashMap<Object, Object>(parts.size()/2);
Map<Object, Object> result = new LinkedHashMap<Object, Object>(parts.size()/2);
for (int i = 0; i < parts.size(); i++) {
if (i % 2 != 0) {
result.put(parts.get(i-1), parts.get(i));

@ -15,7 +15,7 @@
*/
package org.redisson.client.protocol.decoder;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@ -32,7 +32,7 @@ public class ObjectSetReplayDecoder<T> implements MultiDecoder<Set<T>> {
@Override
public Set<T> decode(List<Object> parts, State state) {
return new HashSet(parts);
return new LinkedHashSet(parts);
}
@Override

Loading…
Cancel
Save