As Charlie points out, we can use the protected constructor if we're creating

an anonymous extension of DefaultMap and any other creation is better done
through the static factory methods, so don't present the user with a pointless
choice.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5982 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2009-10-23 04:58:49 +00:00
parent b124934a97
commit 6137fbfb79
+9 -9
View File
@@ -95,15 +95,6 @@ public class DefaultMap<K, V> extends ForwardingMap<K, V>
return new DefaultMap<K, V>(delegate, creator);
}
/**
* Creates a default map backed by the supplied map using the supplied default creator.
*/
public DefaultMap (Map<K, V> delegate, Function<K, V> creator)
{
_delegate = delegate;
_creator = creator;
}
/**
* Looks up the supplied key in the map, returning the value to which it is mapped. If the key
* has no mapping, a default value will be obtained for the requested key and placed into the
@@ -119,6 +110,15 @@ public class DefaultMap<K, V> extends ForwardingMap<K, V>
return value;
}
/**
* Creates a default map backed by the supplied map using the supplied default creator.
*/
protected DefaultMap (Map<K, V> delegate, Function<K, V> creator)
{
_delegate = delegate;
_creator = creator;
}
@Override // from ForwardingMap
protected Map<K, V> delegate()
{