Klasse ImmutableValueMap
java.lang.Object
org.apache.sling.testing.mock.sling.builder.ImmutableValueMap
@ProviderType
public final class ImmutableValueMap
extends Object
implements org.apache.sling.api.resource.ValueMap
ValueMap that does not support changing its content.
All methods that may change the content will throw a
UnsupportedOperationException.
Static convenience methods provide similar behavior as Guava ImmutableMap variants.
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic final classBuilder interface forImmutableValueMap. -
Feldübersicht
Von Schnittstelle geerbte Felder org.apache.sling.api.resource.ValueMap
EMPTY -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic @NotNull ImmutableValueMap.Builderbuilder()Returns a new builder.voidclear()Veraltet.Unsupported operationbooleancontainsKey(Object key) booleancontainsValue(Object value) static @NotNull ImmutableValueMapReturns an immutable map containing the same entries asmap.entrySet()boolean<T> T<T> TinthashCode()booleanisEmpty()keySet()static @NotNull ImmutableValueMapof()Returns the empty map.static @NotNull ImmutableValueMapReturns an immutable map containing a single entry.static @NotNull ImmutableValueMapReturns an immutable map containing the given entries, in order.static @NotNull ImmutableValueMapof(@NotNull String k1, @NotNull Object v1, @NotNull String k2, @NotNull Object v2, @NotNull String k3, @NotNull Object v3) Returns an immutable map containing the given entries, in order.static @NotNull ImmutableValueMapof(@NotNull String k1, @NotNull Object v1, @NotNull String k2, @NotNull Object v2, @NotNull String k3, @NotNull Object v3, @NotNull String k4, @NotNull Object v4) Returns an immutable map containing the given entries, in order.static ImmutableValueMapof(@NotNull String k1, @NotNull Object v1, @NotNull String k2, @NotNull Object v2, @NotNull String k3, @NotNull Object v3, @NotNull String k4, @NotNull Object v4, @NotNull String k5, @NotNull Object v5) Returns an immutable map containing the given entries, in order.Veraltet.Unsupported operationvoidVeraltet.Unsupported operationVeraltet.Unsupported operationintsize()toString()values()Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitVon Schnittstelle geerbte Methoden java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Methodendetails
-
get
- Angegeben von:
getin Schnittstelleorg.apache.sling.api.resource.ValueMap
-
get
- Angegeben von:
getin Schnittstelleorg.apache.sling.api.resource.ValueMap
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Angegeben von:
containsKeyin SchnittstelleMap<String,Object>
-
containsValue
- Angegeben von:
containsValuein SchnittstelleMap<String,Object>
-
get
-
keySet
-
values
-
entrySet
-
hashCode
public int hashCode() -
equals
-
toString
-
put
Veraltet.Unsupported operation -
remove
Veraltet.Unsupported operation -
putAll
Veraltet.Unsupported operation -
clear
Veraltet.Unsupported operation -
of
Returns the empty map. This map behaves and performs comparably toCollections.emptyMap(), and is preferable mainly for consistency and maintainability of your code.- Gibt zurück:
- ImmutableValueMap
-
of
@NotNull public static @NotNull ImmutableValueMap of(@NotNull @NotNull String k1, @NotNull @NotNull Object v1) Returns an immutable map containing a single entry. This map behaves and performs comparably toCollections.singletonMap(K, V)but will not accept a null key or value. It is preferable mainly for consistency and maintainability of your code.- Parameter:
k1- Key 1v1- Value 1- Gibt zurück:
- ImmutableValueMap
-
of
@NotNull public static @NotNull ImmutableValueMap of(@NotNull @NotNull String k1, @NotNull @NotNull Object v1, @NotNull @NotNull String k2, @NotNull @NotNull Object v2) Returns an immutable map containing the given entries, in order.- Parameter:
k1- Key 1v1- Value 1k2- Key 2v2- Value 2- Gibt zurück:
- ImmutableValueMap
- Löst aus:
IllegalArgumentException- if duplicate keys are provided
-
of
@NotNull public static @NotNull ImmutableValueMap of(@NotNull @NotNull String k1, @NotNull @NotNull Object v1, @NotNull @NotNull String k2, @NotNull @NotNull Object v2, @NotNull @NotNull String k3, @NotNull @NotNull Object v3) Returns an immutable map containing the given entries, in order.- Parameter:
k1- Key 1v1- Value 1k2- Key 2v2- Value 2k3- Key 3v3- Value 3- Gibt zurück:
- ImmutableValueMap
- Löst aus:
IllegalArgumentException- if duplicate keys are provided
-
of
@NotNull public static @NotNull ImmutableValueMap of(@NotNull @NotNull String k1, @NotNull @NotNull Object v1, @NotNull @NotNull String k2, @NotNull @NotNull Object v2, @NotNull @NotNull String k3, @NotNull @NotNull Object v3, @NotNull @NotNull String k4, @NotNull @NotNull Object v4) Returns an immutable map containing the given entries, in order.- Parameter:
k1- Key 1v1- Value 1k2- Key 2v2- Value 2k3- Key 3v3- Value 3k4- Key 4v4- Value 4- Gibt zurück:
- ImmutableValueMap
- Löst aus:
IllegalArgumentException- if duplicate keys are provided
-
of
public static ImmutableValueMap of(@NotNull @NotNull String k1, @NotNull @NotNull Object v1, @NotNull @NotNull String k2, @NotNull @NotNull Object v2, @NotNull @NotNull String k3, @NotNull @NotNull Object v3, @NotNull @NotNull String k4, @NotNull @NotNull Object v4, @NotNull @NotNull String k5, @NotNull @NotNull Object v5) Returns an immutable map containing the given entries, in order.- Parameter:
k1- Key 1v1- Value 1k2- Key 2v2- Value 2k3- Key 3v3- Value 3k4- Key 4v4- Value 4k5- Key 5v5- Value 5- Gibt zurück:
- ImmutableValueMap
- Löst aus:
IllegalArgumentException- if duplicate keys are provided
-
builder
Returns a new builder. The generated builder is equivalent to the builder created by theImmutableValueMap.Builderconstructor.- Gibt zurück:
- Builder
-
copyOf
Returns an immutable map containing the same entries asmap. Ifmapsomehow contains entries with duplicate keys (for example, if it is aSortedMapwhose comparator is not consistent with equals), the results of this method are undefined.Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change.
- Parameter:
map- Map- Gibt zurück:
- ImmutableValueMap
- Löst aus:
NullPointerException- if any key or value inmapis null
-