public interface PMap<K,V>
Modifier and Type | Interface and Description |
---|---|
static interface |
PMap.Reconciler<K,V>
|
Modifier and Type | Method and Description |
---|---|
boolean |
equivalent(PMap<K,V> that,
java.util.function.BiPredicate<V,V> equivalence)
Checks equality recursively based on the given equivalence.
|
V |
get(K key)
Retrieves the given key from the map, or returns null if it is not present.
|
boolean |
isEmpty()
Returns whether this map is empty.
|
java.lang.Iterable<K> |
keys()
Returns an iterable for the keys in this map.
|
PMap<K,V> |
minus(K key)
Returns a new map with the given key removed.
|
PMap<K,V> |
plus(K key,
V value)
Returns a new map with the given key-value pair added.
|
PMap<K,V> |
reconcile(PMap<K,V> that,
PMap.Reconciler<K,V> joiner)
Performs a reconcile operation to merge
this and that . |
java.lang.Iterable<V> |
values()
Returns an iterable for the values in this map.
|
boolean isEmpty()
java.lang.Iterable<V> values()
java.lang.Iterable<K> keys()
@Nullable V get(K key)
PMap<K,V> plus(K key, V value)
PMap<K,V> minus(K key)
PMap<K,V> reconcile(PMap<K,V> that, PMap.Reconciler<K,V> joiner)
this
and that
.
joiner
is called for each pair of entries, one from each map, which share the same
key and whose values are not Object.equals(java.lang.Object)
. This includes entries that are absent from
one of the maps, for which null
is passed as the absent value.
The return of calling joiner
will appear in the merged map at the key of the
original entry pair. The return may not be null. If the values in a pair of entries are Object.equals(java.lang.Object)
, that value will be used directly in the result without calling joiner
.
The first value passed to joiner
comes from this
, and the second value comes
from that
. There are no guarantees on the source of key
. Note that that
map must be the same implementation.
boolean equivalent(PMap<K,V> that, java.util.function.BiPredicate<V,V> equivalence)
that
map must be the same implementation. Note
that the equivalence MUST be reflective (i.e. equivalence.test(x, x) == true).Copyright © 2009-2020 Google. All Rights Reserved.