Package de.xima.fc.common.collection
Class CrudMapAdapter.SetLike<Value>
- java.lang.Object
-
- de.xima.fc.common.collection.CrudMapAdapter.SetLike<Value>
-
- Type Parameters:
Value- Type of the values in the set.
- All Implemented Interfaces:
CrudMapAdapter<Value,Unit>,Serializable
- Direct Known Subclasses:
CrudMapAdapter.SetLike.Immutable
- Enclosing interface:
- CrudMapAdapter<Key,Value>
public abstract static class CrudMapAdapter.SetLike<Value> extends Object implements CrudMapAdapter<Value,Unit>, Serializable
ACrudMapAdapterwith aUnitwhose presence corresponds to whether the key is present in aSet. Intended to be used e.g. withCrudMap.newSet(). ImplementsCrudMapAdapter#getby checking whether the key is present, andsetby delegating to eitherdeleteoradd.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCrudMapAdapter.SetLike.Immutable<Value>ACrudMapAdapter.SetLikefor an immutable set.-
Nested classes/interfaces inherited from interface de.xima.fc.common.collection.CrudMapAdapter
CrudMapAdapter.SetLike<Value>
-
-
Constructor Summary
Constructors Constructor Description SetLike()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidadd(Value value)Adds a given value to the set.protected abstract booleancontains(Value value)Checks whether the set contains the given value.Unitget(Value key)Gets the value for the given key.voidset(Value key, Unit unit)Associates a value with the given key.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.xima.fc.common.collection.CrudMapAdapter
computeSize, delete, enumerateCandidateKeys, isEmpty
-
-
-
-
Method Detail
-
get
public final Unit get(Value key)
Description copied from interface:CrudMapAdapterGets the value for the given key. Returnsnullwhen no value is available for the key.- Specified by:
getin interfaceCrudMapAdapter<Value,Unit>- Parameters:
key- Key to access.- Returns:
- The value associated with the key, or
nullwhen no value is associated with the key.
-
set
public final void set(Value key, Unit unit)
Description copied from interface:CrudMapAdapterAssociates a value with the given key.- Specified by:
setin interfaceCrudMapAdapter<Value,Unit>- Parameters:
key- Key to associate with a different value.unit- Value to associate with the key, nevernull.
-
add
protected abstract void add(Value value)
Adds a given value to the set.- Parameters:
value- Value to add.
-
contains
protected abstract boolean contains(Value value)
Checks whether the set contains the given value.- Parameters:
value- Value to check.- Returns:
- Whether the set contains the value.
-
-