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

water.util.IcedHashMap Maven / Gradle / Ivy

package water.util;

import water.nbhm.NonBlockingHashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;

/** Iced / Freezable NonBlockingHashMap.  Delegates to a NonBlockingHashMap for
 *  all its operations.  Inspired by water.parser.Categorical.
 */
public class IcedHashMap extends IcedHashMapBase implements ConcurrentMap {
  transient NonBlockingHashMap _map;
  public IcedHashMap() { init(); }
  @Override protected Map map() { return _map; }
  @Override protected Map init() { return _map = new NonBlockingHashMap<>(); }

  public V putIfAbsent(K key, V value)                  { return _map.putIfAbsent(key, value); }
  public boolean remove(Object key, Object value)       { return _map.remove(key, value);  }
  public boolean replace(K key, V oldValue, V newValue) { return _map.replace(key, oldValue, newValue); }
  public V replace(K key, V value)                      { return _map.replace(key, value); }
  public K getk(K key)                                  { return _map.getk(key); }

  // Subtypes which allow us to determine the type parameters at runtime, for generating schema metadata.
  public static class IcedHashMapStringString extends IcedHashMap {}
  public static class IcedHashMapStringObject extends IcedHashMap {}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy