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
A CrudMapAdapter with a Unit whose presence corresponds to whether the key is present in a Set. Intended to be used e.g. with CrudMap.newSet(). Implements CrudMapAdapter#get by checking whether the key is present, and set by delegating to either delete or add.
Since:
8.2.0
Author:
XIMA MEDIA GmbH
See Also:
  • Constructor Details

    • SetLike

      public SetLike()
  • Method Details

    • get

      public final Unit get(Value key)
      Description copied from interface: CrudMapAdapter
      Gets the value for the given key. Returns null when no value is available for the key.
      Specified by:
      get in interface CrudMapAdapter<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 interface CrudMapAdapter<Value,Unit>
      Parameters:
      key - Key to associate with a different value.
      unit - Value to associate with the key, never null.
    • 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.