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>
- Direct Known Subclasses:
CrudMapAdapter.SetLike.Immutable
- Enclosing interface:
- CrudMapAdapter<Key,Value>
public abstract static class CrudMapAdapter.SetLike<Value> extends Object implements CrudMapAdapter<Value,Unit>
ACrudMapAdapter
with aUnit
whose presence corresponds to whether the key is present in aSet
. Intended to be used e.g. withCrudMap.newSet()
. ImplementsCrudMapAdapter#get
by checking whether the key is present, andset
by delegating to eitherdelete
oradd
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CrudMapAdapter.SetLike.Immutable<Value>
ACrudMapAdapter.SetLike
for 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 void
add(Value value)
Adds a given value to the set.protected abstract boolean
contains(Value value)
Checks whether the set contains the given value.Unit
get(Value key)
Gets the value for the given key.void
set(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:CrudMapAdapter
Gets the value for the given key. Returnsnull
when no value is available for the key.- Specified by:
get
in interfaceCrudMapAdapter<Value,Unit>
- Parameters:
key
- Key to access.- Returns:
- The value associated with the key, or
null
when no value is associated with the key.
-
set
public final void set(Value key, Unit unit)
Description copied from interface:CrudMapAdapter
Associates a value with the given key.- Specified by:
set
in 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.
-
-