KEYTYPE - Key typeVALUETYPE - Value type@NotThreadSafe public class MapBasedReadOnlyAttributeContainer<KEYTYPE,VALUETYPE> extends Object implements IAttributeContainer<KEYTYPE,VALUETYPE>
IAttributeContainer based on a
HashMap. This implementation may carry null values but
that is not recommended.| Modifier and Type | Field and Description |
|---|---|
protected ICommonsMap<KEYTYPE,VALUETYPE> |
m_aAttrs
Main attribute storage.
|
| Modifier | Constructor and Description |
|---|---|
protected |
MapBasedReadOnlyAttributeContainer(boolean bDummy,
ICommonsMap<KEYTYPE,VALUETYPE> aAttrMap)
Constructor to use a custom map for the attribute container
|
|
MapBasedReadOnlyAttributeContainer(IAttributeContainer<? extends KEYTYPE,? extends VALUETYPE> aCont) |
|
MapBasedReadOnlyAttributeContainer(KEYTYPE aKey,
VALUETYPE aValue) |
|
MapBasedReadOnlyAttributeContainer(Map<? extends KEYTYPE,? extends VALUETYPE> aMap) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsAttribute(KEYTYPE aName)
Check if an attribute of the given name is contained.
|
boolean |
equals(Object o) |
void |
forAllAttributes(BiConsumer<? super KEYTYPE,? super VALUETYPE> aConsumer)
Perform an operation on all contained attributes.
|
void |
forAllAttributeValues(Consumer<? super VALUETYPE> aConsumer)
Perform an operation on all contained attribute values.
|
ICommonsSet<KEYTYPE> |
getAllAttributeNames() |
ICommonsMap<KEYTYPE,VALUETYPE> |
getAllAttributes() |
ICommonsCollection<VALUETYPE> |
getAllAttributeValues() |
int |
getAttributeCount() |
VALUETYPE |
getAttributeObject(KEYTYPE aName)
Get the attribute value associated to the given attribute name.
|
int |
hashCode() |
boolean |
isEmpty() |
Iterator<Map.Entry<KEYTYPE,VALUETYPE>> |
iterator() |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetAttributeAsBigDecimal, getAttributeAsBigDecimal, getAttributeAsBigInteger, getAttributeAsBigInteger, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDouble, getAttributeAsDouble, getAttributeAsInt, getAttributeAsInt, getAttributeAsLong, getAttributeAsLong, getAttributeAsString, getAttributeAsString, getCastedAttribute, getCastedAttribute, getTypedAttribute, getTypedAttribute, isNotEmptycontainsAny, containsNone, containsOnly, findAll, findAllInstanceOf, findAllMapped, findAllMapped, findAllMapped, findFirst, findFirst, findFirstMapped, findFirstMapped, forEach, forEach, forEachBreakable, getIteratorCount, getIteratorCountforEach, spliteratorprotected final ICommonsMap<KEYTYPE,VALUETYPE> m_aAttrs
public MapBasedReadOnlyAttributeContainer(@Nonnull KEYTYPE aKey, @Nullable VALUETYPE aValue)
public MapBasedReadOnlyAttributeContainer(@Nullable Map<? extends KEYTYPE,? extends VALUETYPE> aMap)
public MapBasedReadOnlyAttributeContainer(@Nonnull IAttributeContainer<? extends KEYTYPE,? extends VALUETYPE> aCont)
protected MapBasedReadOnlyAttributeContainer(boolean bDummy,
@Nonnull
ICommonsMap<KEYTYPE,VALUETYPE> aAttrMap)
bDummy - Dummy parameter to be used to uniquely specify the constructoraAttrMap - The attribute map to be used.public boolean containsAttribute(@Nullable KEYTYPE aName)
IAttributeContainercontainsAttribute in interface IAttributeContainer<KEYTYPE,VALUETYPE>aName - name of the attribute to checktrue if the attribute is contained, false
otherwise@Nonnull @ReturnsMutableCopy public ICommonsMap<KEYTYPE,VALUETYPE> getAllAttributes()
getAllAttributes in interface IAttributeContainer<KEYTYPE,VALUETYPE>null map with all contained attributes.public void forAllAttributes(@Nonnull BiConsumer<? super KEYTYPE,? super VALUETYPE> aConsumer)
IAttributeContainerforAllAttributes in interface IAttributeContainer<KEYTYPE,VALUETYPE>aConsumer - The consumer to be invoked.public void forAllAttributeValues(@Nonnull Consumer<? super VALUETYPE> aConsumer)
IAttributeContainerforAllAttributeValues in interface IAttributeContainer<KEYTYPE,VALUETYPE>aConsumer - The consumer to be invoked.@Nonnull @ReturnsMutableCopy public ICommonsSet<KEYTYPE> getAllAttributeNames()
getAllAttributeNames in interface IAttributeContainer<KEYTYPE,VALUETYPE>null set of all attribute names.@Nonnull @ReturnsMutableCopy public ICommonsCollection<VALUETYPE> getAllAttributeValues()
getAllAttributeValues in interface IAttributeContainer<KEYTYPE,VALUETYPE>null collection of all attribute values.@Nullable public VALUETYPE getAttributeObject(@Nullable KEYTYPE aName)
IAttributeContainergetAttributeObject in interface IAttributeContainer<KEYTYPE,VALUETYPE>aName - the attribute namenull if no such value exists@Nonnegative public int getAttributeCount()
getAttributeCount in interface IAttributeContainer<KEYTYPE,VALUETYPE>public boolean isEmpty()
isEmpty in interface IAttributeContainer<KEYTYPE,VALUETYPE>true if this attribute container does not contain any
attribute at all, false if at least one attribute is
contained.Copyright © 2014–2017 Philip Helger. All rights reserved.