T
- the type of values for this dictionary@Immutable public final class Dictionary<T> extends Object implements Frozen<DictionaryBuilder<T>>
This class is a wrapper over a Map
, where keys are always String
s. The type of values is arbitrary.
This class is immutable. If you want to build a dictionary, you have two options:
newBuilder()
;thaw()
.For instance:
// New builder final DictionaryBuilder<Foo> builder = Dictionary.newBuilder(); // From an existing dictionary final DictionaryBuilder<Foo> builder = dict.thaw();
DictionaryBuilder
Modifier and Type | Method and Description |
---|---|
Map<String,T> |
entries()
Return the entries from this dictionary as a map
|
static <T> DictionaryBuilder<T> |
newBuilder()
Return a new, empty builder for a dictionary of this type
|
DictionaryBuilder<T> |
thaw()
Return a builder with a copy of all entries from this dictionary
|
public static <T> DictionaryBuilder<T> newBuilder()
T
- the type of valuespublic Map<String,T> entries()
The returned map is immutable.
ImmutableMap
public DictionaryBuilder<T> thaw()
thaw
in interface Frozen<DictionaryBuilder<T>>
DictionaryBuilder