提交 870a8593 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Replace DataUtils.MapEntry with AbstractMap.SimpleImmutableEntry

上级 97e44699
......@@ -1026,39 +1026,6 @@ public final class DataUtils {
}
}
/**
* An entry of a map.
*
* @param <K> the key type
* @param <V> the value type
*/
public static final class MapEntry<K, V> implements Map.Entry<K, V> {
private final K key;
private final V value;
public MapEntry(K key, V value) {
this.key = key;
this.value = value;
}
@Override
public K getKey() {
return key;
}
@Override
public V getValue() {
return value;
}
@Override
public V setValue(V value) {
throw newUnsupportedOperationException("Updating the value is not supported");
}
}
/**
* Get the configuration parameter value, or default.
*
......
......@@ -673,7 +673,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
@Override
public Entry<K, V> next() {
K k = cursor.next();
return new DataUtils.MapEntry<>(k, cursor.getValue());
return new SimpleImmutableEntry<>(k, cursor.getValue());
}
@Override
......
......@@ -5,6 +5,7 @@
*/
package org.h2.mvstore.db;
import java.util.AbstractMap;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
......@@ -18,7 +19,6 @@ import org.h2.index.BaseIndex;
import org.h2.index.Cursor;
import org.h2.index.IndexType;
import org.h2.message.DbException;
import org.h2.mvstore.DataUtils;
import org.h2.mvstore.tx.Transaction;
import org.h2.mvstore.tx.TransactionMap;
import org.h2.result.Row;
......@@ -261,7 +261,7 @@ public class MVPrimaryIndex extends BaseIndex {
Collections.<Entry<Value, Value>> emptyList().iterator());
}
Value value = map.get(v);
Entry<Value, Value> e = new DataUtils.MapEntry<Value, Value>(v, value);
Entry<Value, Value> e = new AbstractMap.SimpleImmutableEntry<Value, Value>(v, value);
List<Entry<Value, Value>> list = Collections.singletonList(e);
MVStoreCursor c = new MVStoreCursor(session, list.iterator());
c.next();
......
......@@ -9,6 +9,8 @@ import org.h2.mvstore.Cursor;
import org.h2.mvstore.DataUtils;
import org.h2.mvstore.MVMap;
import org.h2.mvstore.type.DataType;
import java.util.AbstractMap;
import java.util.Iterator;
import java.util.Map;
......@@ -671,7 +673,7 @@ public class TransactionMap<K, V> {
if (data != null && data.value != null) {
@SuppressWarnings("unchecked")
final V value = (V) data.value;
current = new DataUtils.MapEntry<>(key, value);
current = new AbstractMap.SimpleImmutableEntry<>(key, value);
currentKey = key;
return;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论