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

com.softicar.platform.common.container.map.number.INumberMap Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
package com.softicar.platform.common.container.map.number;

import com.softicar.platform.common.math.arithmetic.IArithmetic;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

/**
 * Common interface for all maps containing numeric values.
 * 

* An {@link INumberMap} is actually just a convenience facade for a regular * {@link Map}. * * @param * the type of the keys * @param * the type of the values * @author Oliver Richers */ public interface INumberMap { Map getDataContainer(); IArithmetic getArithmetic(); // -------------------- read-only -------------------- // boolean containsKey(K key); /** * Same as {@link #getOrZero}. * * @param key * the key * @return the corresponding value or zero */ V get(K key); /** * Returns the corresponding value or the given default value. * * @param key * the key * @return the corresponding value or the default value */ V getOrDefault(K key, V defaultValue); /** * Returns the corresponding value or null. * * @param key * the key * @return the corresponding value or null */ V getOrNull(K key); /** * Returns the corresponding value or throws an exception. * * @param key * the key * @return the corresponding value or throws an exception * @throws RuntimeException * if no matching value exists in the map */ V getOrThrow(K key); /** * Returns the corresponding value or zero. * * @param key * the key * @return the corresponding value or zero */ V getOrZero(K key); boolean isEmpty(); int size(); Set keySet(); Set> entrySet(); Collection values(); // -------------------- mutating -------------------- // void clear(); void put(K key, V value); void putAll(Map map); void putAll(INumberMap map); V remove(K key); // -------------------- arithmetics -------------------- // void add(K key, V value); void sub(K key, V value); void add(INumberMap other); void sub(INumberMap other); void inc(K key); void dec(K key); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy