Class MapBackedDirectory<K,V>

java.lang.Object
org.verapdf.core.MapBackedDirectory<K,V>
Type Parameters:
K - A key or lookup type
V - A value type
All Implemented Interfaces:
Directory<K,V>
Direct Known Subclasses:
MapBackedRegistry

public class MapBackedDirectory<K,V> extends Object implements Directory<K,V>
A Map backed Directory implementation.
Author:
Carl Wilson
  • Field Details

    • map

      protected final Map<K,V> map
  • Constructor Details

    • MapBackedDirectory

      public MapBackedDirectory()
      Creates an empty directory backed by an empty Map
    • MapBackedDirectory

      public MapBackedDirectory(Map<K,V> map)
      Parameters:
      map -
  • Method Details

    • getItem

      public V getItem(K key)
      { @inheritDoc }
      Specified by:
      getItem in interface Directory<K,V>
      Parameters:
      key - the key used to lookup a particular item
      Returns:
      the value instance associated with the key
    • getItems

      public List<V> getItems()
      { @inheritDoc }
      Specified by:
      getItems in interface Directory<K,V>
      Returns:
      the Collection of values contained in the directory
    • getKeys

      public Set<K> getKeys()
      { @inheritDoc }
      Specified by:
      getKeys in interface Directory<K,V>
      Returns:
      the Set of keys contained in the directory
    • size

      public int size()
      { @inheritDoc }
      Specified by:
      size in interface Directory<K,V>
      Returns:
      the number of items held in the directory
    • isEmpty

      public boolean isEmpty()
      { @inheritDoc }
      Specified by:
      isEmpty in interface Directory<K,V>
      Returns:
      true if the directory contains no items, false if not.
    • hashCode

      public int hashCode()
      { @inheritDoc }
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      { @inheritDoc }
      Overrides:
      equals in class Object