public final class OptionMap extends Object implements Iterable<Option<?>>, Serializable
null
keys or values are permitted.Modifier and Type | Class and Description |
---|---|
static class |
OptionMap.Builder
A builder for immutable option maps.
|
Modifier and Type | Field and Description |
---|---|
static OptionMap |
EMPTY
The empty option map.
|
Modifier and Type | Method and Description |
---|---|
static OptionMap.Builder |
builder()
Create a new builder.
|
boolean |
contains(Option<?> option)
Determine whether this option map contains the given option.
|
static <T> OptionMap |
create(Option<T> option,
T value)
Create a single-valued option map.
|
static <T1,T2> OptionMap |
create(Option<T1> option1,
T1 value1,
Option<T2> option2,
T2 value2)
Create a two-valued option map.
|
boolean |
equals(Object other)
Determine whether this option map is equal to another.
|
boolean |
equals(OptionMap other)
Determine whether this option map is equal to another.
|
boolean |
get(Option<Boolean> option,
boolean defaultValue)
Get a boolean value from this option map, with a specified default if the value is missing.
|
int |
get(Option<Integer> option,
int defaultValue)
Get a int value from this option map, with a specified default if the value is missing.
|
long |
get(Option<Long> option,
long defaultValue)
Get a long value from this option map, with a specified default if the value is missing.
|
<T> T |
get(Option<T> option)
Get the value of an option from this option map.
|
<T> T |
get(Option<T> option,
T defaultValue)
Get the value of an option from this option map, with a specified default if the value is missing.
|
int |
hashCode()
Get the hash code for this option map.
|
Iterator<Option<?>> |
iterator()
Iterate over the options in this map.
|
int |
size()
Get the number of options stored in this map.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final OptionMap EMPTY
public boolean contains(Option<?> option)
option
- the option to checktrue
if the option is present in the option mappublic <T> T get(Option<T> option)
T
- the type of the optionoption
- the option to getnull
if it is not presentpublic <T> T get(Option<T> option, T defaultValue)
T
- the type of the optionoption
- the option to getdefaultValue
- the value to return if the option is not setnull
if it is not presentpublic boolean get(Option<Boolean> option, boolean defaultValue)
option
- the option to getdefaultValue
- the default value if the option is not presentpublic int get(Option<Integer> option, int defaultValue)
option
- the option to getdefaultValue
- the default value if the option is not presentpublic long get(Option<Long> option, long defaultValue)
option
- the option to getdefaultValue
- the default value if the option is not presentpublic int size()
public static OptionMap.Builder builder()
public static <T> OptionMap create(Option<T> option, T value)
T
- the option value typeoption
- the option to put in the mapvalue
- the option valuepublic static <T1,T2> OptionMap create(Option<T1> option1, T1 value1, Option<T2> option2, T2 value2)
T1
- the first option value typeT2
- the second option value typeoption1
- the first option to put in the mapvalue1
- the first option valueoption2
- the second option to put in the mapvalue2
- the second option valuepublic boolean equals(Object other)
public boolean equals(OptionMap other)
other
- the other option maptrue
if they are equal, false
otherwiseCopyright © 2019 JBoss by Red Hat. All rights reserved.