All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cedarsoft.utils.Cache Maven / Gradle / Ivy

The newest version!
package com.cedarsoft.utils;

import org.jetbrains.annotations.NotNull;

import java.util.Map;

/**
 * A mapped cache.
 * If there is no entry for a given key, the entry is automatically created using a factory.
 *
 * @param  the key
 * @param  the type that is stored within the cache
 */
public interface Cache extends Map {

  /**
   * A factory that is used to fill the cache
   */
  interface Factory {
    /**
     * Create the object for the given key
     *
     * @param key the key
     * @return the object
     */
    @NotNull
    T create( @NotNull K key );
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy