mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
Define iteration order of BdfDictionary.
This commit is contained in:
@@ -3,11 +3,10 @@ package org.briarproject.api.data;
|
||||
import org.briarproject.api.Bytes;
|
||||
import org.briarproject.api.FormatException;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
|
||||
public class BdfDictionary extends Hashtable<String, Object> {
|
||||
public class BdfDictionary extends ConcurrentSkipListMap<String, Object> {
|
||||
|
||||
public static final Object NULL_VALUE = new Object();
|
||||
|
||||
|
||||
@@ -2,11 +2,10 @@ package org.briarproject.api.data;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
// This class is not thread-safe
|
||||
public class BdfEntry implements Entry<String, Object> {
|
||||
public class BdfEntry implements Entry<String, Object>, Comparable<BdfEntry> {
|
||||
|
||||
private final String key;
|
||||
private Object value;
|
||||
private final Object value;
|
||||
|
||||
public BdfEntry(String key, Object value) {
|
||||
this.key = key;
|
||||
@@ -25,8 +24,12 @@ public class BdfEntry implements Entry<String, Object> {
|
||||
|
||||
@Override
|
||||
public Object setValue(Object value) {
|
||||
Object oldValue = this.value;
|
||||
this.value = value;
|
||||
return oldValue;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(BdfEntry e) {
|
||||
if (e == this) return 0;
|
||||
return key.compareTo(e.key);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user