
public class MapAttributes extends Object implements Attributes
Attributes.Entry, Attributes.SetEntryEMPTY| Constructor and Description |
|---|
MapAttributes()
Construct an instance using a hash map for backing store.
|
MapAttributes(Attributes original)
Construct a new instance copying mappings from an original attributes collection.
|
MapAttributes(Map<String,? extends Collection<String>> original)
Construct a new instance copying mappings from an original map.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(String key,
int idx,
String value)
Add a mapping for the given key at the given position.
|
void |
addFirst(String key,
String value)
Add a value before the first mapping for the given key.
|
void |
addLast(String key,
String value)
Add a value after the last mapping for the given key.
|
void |
clear()
Clear this collection, resetting its size to zero.
|
boolean |
containsKey(String key)
Determine if the given key has values in this collection.
|
boolean |
containsValue(String key,
String value)
Determine if the given key has a mapping for the given value in this collection.
|
List<String> |
copyAndRemove(String key)
Remove all values for the given key from this collection, copying the values into a list which is returned.
|
List<String> |
copyAndReplace(String key,
Collection<String> values)
Replace the mapping for the given key with the values copied from the given collection.
|
Collection<Attributes.Entry> |
entries()
Get the entry collection.
|
Attributes.Entry |
get(String key)
Get the collection of values for the given key.
|
String |
get(String key,
int idx)
Get the mapping for the given key at the given position.
|
String |
getFirst(String key)
Get the first value mapped to the given key.
|
String |
getLast(String key)
Get the last value mapped to the given key.
|
int |
indexOf(String key,
String value)
Get the index of the first occurrence of the given value at the given key, if any.
|
boolean |
isEmpty()
Determine if this collection is empty.
|
Set<String> |
keySet()
Get a set comprised of all the keys in this collection.
|
int |
lastIndexOf(String key,
String value)
Get the index of the last occurrence of the given value at the given key, if any.
|
boolean |
remove(String key)
Remove all values for the given key from this collection.
|
String |
remove(String key,
int idx)
Remove and return the mapping for the given key at the given position.
|
boolean |
remove(String key,
int idx,
String value)
Remove the mapping for the given key at the given position if it matches the given existing value.
|
boolean |
removeAll(String key,
String value)
Remove the all occurrences of the given value under the given key, if any.
|
String |
removeFirst(String key)
Remove the first value mapped to the given key.
|
boolean |
removeFirst(String key,
String value)
Remove the first occurrence of the given value under the given key, if any.
|
String |
removeLast(String key)
Remove the last value mapped to the given key.
|
boolean |
removeLast(String key,
String value)
Remove the last occurrence of the given value under the given key, if any.
|
void |
removeRange(String key,
int from,
int to)
Remove all the values for the given key between the
from index (inclusive) and the to index
(exclusive). |
String |
set(String key,
int idx,
String value)
Modify the mapping for the given key at the given position.
|
boolean |
set(String key,
int idx,
String expect,
String update)
Conditionally set a specific value of a given key to a new value, if the existing value matches the
expect
parameter. |
int |
size()
Get the number of keys in this attribute collection.
|
int |
size(String key)
Get the number of values mapped to the given key.
|
Collection<String> |
values()
Get all the values of all the keys in this collection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddAll, addAll, asReadOnlypublic MapAttributes()
public MapAttributes(Map<String,? extends Collection<String>> original)
original - the original mappublic MapAttributes(Attributes original)
original - the original collectionpublic Set<String> keySet()
AttributeskeySet in interface Attributesnull)public Collection<String> values()
Attributesvalues in interface Attributesnull)public Collection<Attributes.Entry> entries()
Attributesentries in interface Attributespublic int size(String key)
Attributessize in interface Attributeskey - the keypublic boolean remove(String key)
Attributesremove in interface Attributeskey - the keytrue if the key was found, false otherwisepublic void add(String key, int idx, String value)
Attributesadd in interface Attributeskey - the keyidx - the indexvalue - the mapping valuepublic String get(String key, int idx)
Attributesget in interface Attributeskey - the keyidx - the indexpublic String set(String key, int idx, String value)
Attributesset in interface Attributeskey - the keyidx - the indexvalue - the mapping valuepublic String remove(String key, int idx)
Attributesremove in interface Attributeskey - the keyidx - the indexpublic List<String> copyAndRemove(String key)
AttributescopyAndRemove in interface Attributeskey - the keynull)public List<String> copyAndReplace(String key, Collection<String> values)
AttributescopyAndReplace in interface Attributeskey - the keyvalues - the new valuespublic boolean containsKey(String key)
AttributescontainsKey in interface Attributeskey - the keytrue if the key has values, false otherwisepublic boolean containsValue(String key, String value)
AttributescontainsValue in interface Attributeskey - the keyvalue - the valuetrue if the key has a mapping to the given value, false otherwisepublic void removeRange(String key, int from, int to)
Attributesfrom index (inclusive) and the to index
(exclusive).removeRange in interface Attributeskey - the keyfrom - the start index (inclusive)to - the end index (exclusive)public int indexOf(String key, String value)
AttributesindexOf in interface Attributeskey - the keyvalue - the valuepublic int lastIndexOf(String key, String value)
AttributeslastIndexOf in interface Attributeskey - the keyvalue - the valuepublic boolean set(String key, int idx, String expect, String update)
Attributesexpect
parameter.set in interface Attributeskey - the keyidx - the indexexpect - the expected valueupdate - the value to settrue if the actual value matched the expected value and was updated, false otherwisepublic String getFirst(String key)
AttributesgetFirst in interface Attributeskey - the keypublic String getLast(String key)
AttributesgetLast in interface Attributeskey - the keypublic void addFirst(String key, String value)
AttributesaddFirst in interface Attributeskey - the keyvalue - the valuepublic void addLast(String key, String value)
AttributesaddLast in interface Attributeskey - the keyvalue - the valuepublic boolean removeFirst(String key, String value)
AttributesremoveFirst in interface Attributeskey - the keyvalue - the value to removetrue if the value was found and removed, false otherwisepublic boolean removeLast(String key, String value)
AttributesremoveLast in interface Attributeskey - the keyvalue - the value to removetrue if the value was found and removed, false otherwisepublic String removeFirst(String key)
AttributesremoveFirst in interface Attributeskey - the keypublic String removeLast(String key)
AttributesremoveLast in interface Attributeskey - the keypublic boolean remove(String key, int idx, String value)
Attributesremove in interface Attributeskey - the keyidx - the indexvalue - the expected previous mapping valuetrue if the value matched and was removed, false otherwisepublic boolean removeAll(String key, String value)
AttributesremoveAll in interface Attributeskey - the keyvalue - the value to removetrue if the value was found and removed, false otherwisepublic Attributes.Entry get(String key)
AttributesAttributes.SetEntry if the values
are distinct (for example, a role or group set).get in interface Attributeskey - the attribute namepublic int size()
Attributessize in interface Attributespublic boolean isEmpty()
AttributesisEmpty in interface Attributestrue if the collection is empty, false otherwisepublic void clear()
Attributesclear in interface AttributesCopyright © 2020 JBoss by Red Hat. All rights reserved.