Class StoreAndRetrieve

java.lang.Object
fr.sandro642.github.misc.StoreAndRetrieve

public class StoreAndRetrieve extends Object
StoreAndRetrieve is a utility class for storing and retrieving key-value pairs. It provides methods to add, get, remove, and check for keys in a map. * This class is used to manage configuration values such as the base URL of an API and file locations.
  • Field Details

    • URL_KEY

      public final String URL_KEY
      URL_KEY is the key used to store the base URL of the API. FILE_LOCATION_KEY is the key used to store the file location for resources. store is a HashMap that holds key-value pairs for configuration settings.
      See Also:
    • FILE_LOCATION_KEY

      public final String FILE_LOCATION_KEY
      See Also:
    • store

      public final HashMap<String,Object> store
  • Constructor Details

    • StoreAndRetrieve

      public StoreAndRetrieve()
  • Method Details

    • put

      public void put(String key, Object value)
      Add a key-value pair to the store.
      Parameters:
      key - is the key under which the value will be stored.
      value - is the value to be stored under the specified key.
    • get

      public Object get(String key)
      Retrieve a value associated with the specified key.
      Parameters:
      key - is the key for which the value will be retrieved.
      Returns:
      the value associated with the specified key, or null if the key does not exist.
    • remove

      public void remove(String key)
      Remove a key-value pair from the store.
      Parameters:
      key - is the key of the entry to be removed.
    • containsKey

      public boolean containsKey(String key)
      Check if the store contains a specific key.
      Parameters:
      key - is the key to check for existence in the store.
      Returns:
      true if the key exists, false otherwise.