public final class Settings extends AbstractSet<Setting<?>>
Set of Setting objects,
with the additional property that no two settings having the same identifier
can be simultaneously present in a Settings object.| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Object o) |
<S extends Setting<?>> |
find(S setting)
Returns the setting with the same setting key as the supplied setting, if present.
|
Optional<Setting<?>> |
find(String identifier) |
<E> E |
get(Setting<E> defaultSetting)
Returns the value set for
defaultSetting's key, if present. |
Iterator<Setting<?>> |
iterator() |
static Settings |
of()
Returns an empty
Settings object. |
static Settings |
of(Collection<? extends Setting<?>> c)
Returns a
Settings object containing the supplied settings. |
static Settings |
of(Setting<?>... settings)
Returns a
Settings object containing the supplied settings. |
static Settings |
of(Setting<?> s)
Returns a singleton
Settings object, containing only the supplied setting. |
int |
size() |
equals, hashCode, removeAlladd, addAll, clear, containsAll, isEmpty, remove, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitadd, addAll, clear, containsAll, isEmpty, remove, retainAll, spliterator, toArray, toArrayparallelStream, removeIf, streampublic Optional<Setting<?>> find(String identifier)
identifier - the identifier of the setting to findpublic <S extends Setting<?>> Optional<S> find(S setting)
find(setting.getIdentifier()).flatMap(s -> s.as(setting))
public <E> E get(Setting<E> defaultSetting)
defaultSetting's key, if present.
Otherwise, returns defaultSetting's value.
find(defaultSetting).orElse(defaultSetting).getValue()
public boolean contains(Object o)
contains in interface Collection<Setting<?>>contains in interface Set<Setting<?>>contains in class AbstractCollection<Setting<?>>public int size()
size in interface Collection<Setting<?>>size in interface Set<Setting<?>>size in class AbstractCollection<Setting<?>>public static Settings of(Setting<?> s)
Settings object, containing only the supplied setting.public static Settings of(Setting<?>... settings)
Settings object containing the supplied settings.
For any two settings having the same key, the first will be overwritten by the second.IllegalArgumentException - if any two settings have the same identifierpublic static Settings of(Collection<? extends Setting<?>> c)
Settings object containing the supplied settings.IllegalArgumentException - if any two settings have the same identifierCopyright © 2010–2019 The Apache Software Foundation. All rights reserved.