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

com.carrotsearch.hppcrt.ShortLongMap Maven / Gradle / Ivy

Go to download

High Performance Primitive Collections Realtime (fork of HPPC from Carrotsearch) Fundamental data structures (maps, sets, lists, queues, heaps, sorts) generated for combinations of object and primitive types to conserve JVM memory and speed up execution. The Realtime fork intends to extend the existing collections, by tweaking to remove any dynamic allocations at runtime, and to obtain low variance execution times whatever the input nature.

The newest version!
package com.carrotsearch.hppcrt;

import com.carrotsearch.hppcrt.cursors.ShortLongCursor;

/**
 * An associative container with unique binding from keys to a single value.
 */
 @javax.annotation.Generated(
    date = "2017-07-11T19:16:24+0200",
    value = "KTypeVTypeMap.java") 
public interface ShortLongMap
extends ShortLongAssociativeContainer
{
    /**
     * Place a given key and value in the container.
     * @return Returns the value previously stored under the given key, if an equal key is already in the map and replaces the existing
     *  value only  with the argument value. If the given key was not already in the map,
     *  the given (key, value) pair is inserted in the map and the default value is returned.
     */
    long put(short key, long value);

    /**
     * Trove-inspired API method. An equivalent
     * of the following code:
     * 
     * if (!map.containsKey(key))
     *      map.put(key, value);
     * 
* * @param key The key of the value to check. * @param value The value to put if key does not exist. * @return true if key did not exist and value * was placed in the map. */ boolean putIfAbsent(final short key, final long value); /** * If key exists, putValue is inserted into the map, * otherwise any existing value is incremented by additionValue. * * @param key * The key of the value to adjust. * @param putValue * The value to put if key does not exist. * @param incrementValue * The value to add to the existing value if key exists. * @return Returns the current value associated with key (after * changes). */ long putOrAdd(short key, long putValue, long additionValue); /** * An equivalent of calling * *
     * putOrAdd(key, additionValue, additionValue);
     * 
* * @param key * The key of the value to adjust. * @param additionValue * The value to put or add to the existing value if key * exists. * @return Returns the current value associated with key (after * changes). */ long addTo(short key, long additionValue); /** * @return Returns the value associated with the given key, or the default value * if the key is not associated with any value. * */ long get(short key); /** * Puts all keys from another container to this map, replacing the values * of existing keys, if such keys are present. * * @return Returns the number of keys added to the map as a result of this * call (not previously present in the map). Values of existing keys are overwritten. */ int putAll(ShortLongAssociativeContainer container); /** * Puts all keys from an iterable cursor to this map, replacing the values * of existing keys, if such keys are present. * * @return Returns the number of keys added to the map as a result of this * call (not previously present in the map). Values of existing keys are overwritten. */ int putAll(Iterable iterable); /** * Remove the (key, value) pair associated with the given key, and returns the assocaited value. * The default value is returned if the key did not exist in the map. * @param key */ long remove(short key); /** * Clear all keys and values in the container. */ void clear(); /** * Returns the "default value" value used in containers methods returning * "default value" */ long getDefaultValue(); /** * Set the "default value" value to be used in containers methods returning * "default value" */ void setDefaultValue(final long defaultValue); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy