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

com.github.atdixon.vroom.swipe.HashTreePMap Maven / Gradle / Ivy

Go to download

Work immutably, robustly and in a knowledge-oriented way with Entity maps in Java.

There is a newer version: 0.3.13
Show newest version
package org.pcollections;

import java.util.Map;
import java.util.Map.Entry;




/**
 *
 * A static convenience class for creating efficient persistent maps.
 * 

* This class simply creates HashPMaps backed by IntTreePMaps. * * @author harold */ public final class HashTreePMap { // not instantiable (or subclassable): private HashTreePMap() {} private static final HashPMap EMPTY = HashPMap.empty(IntTreePMap.>>empty()); /** * @param * @param * @return an empty map */ @SuppressWarnings("unchecked") public static HashPMap empty() { return (HashPMap)EMPTY; } /** * @param * @param * @param key * @param value * @return empty().plus(key, value) */ public static HashPMap singleton(final K key, final V value) { return HashTreePMap.empty().plus(key, value); } /** * @param * @param * @param map * @return empty().plusAll(map) */ public static HashPMap from(final Map map) { return HashTreePMap.empty().plusAll(map); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy