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:
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user