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)
This method is semantically equivalent to:
|
Optional<Setting<?>> |
find(String identifier) |
<E> E |
get(Setting<E> defaultSetting)
This method is semantically equivalent to:
|
Iterator<Setting<?>> |
iterator() |
static Settings |
of()
Returns an empty
Settings object. |
static Settings |
of(Collection<? extends Setting<?>> c) |
static Settings |
of(Setting<?>... 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))
S - generic setting typesetting - a setting keypublic <E> E get(Setting<E> defaultSetting)
find(defaultSetting).orElse(defaultSetting).getValue()
E - generic setting typedefaultSetting - a default key for which to obtain a value setdefaultSetting's key, if present.
Otherwise, returns defaultSetting's value.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 - one or more Setting'sSettings 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)
c - a populated Collection of Setting'sSettings object containing the supplied settings.IllegalArgumentException - if any two settings have the same identifierCopyright © 2010–2020 The Apache Software Foundation. All rights reserved.