K
- the type of keys maintained by this safe mapV
- the type of mapped valuespublic static class SafeMap.Builder<K,V> extends Object
Constructor and Description |
---|
Builder(V defaultValue)
Builder constructor that requires a mandatory default value.
|
Modifier and Type | Method and Description |
---|---|
SafeMap.Builder<K,V> |
add(K key,
V value)
Adds a key/value pair to the map.
|
SafeMap<K,V> |
build()
Builds the safe map instance from this builder instance.
|
SafeMap.Builder<K,V> |
defaultKey(K defaultKey)
An optional default key can be set on the map, to be returned when
no mapping is found via
SafeMap.getFirstKey(V) . |
public Builder(V defaultValue)
defaultValue
- the required default value for the mapNullPointerException
- if the default value is nullpublic SafeMap.Builder<K,V> defaultKey(K defaultKey)
SafeMap.getFirstKey(V)
.defaultKey
- the default keypublic SafeMap.Builder<K,V> add(K key, V value)
key
- the keyvalue
- the valueNullPointerException
- if either parameter is nullCopyright © 2016. All Rights Reserved.