de.invation.code.toval.misc.MapUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of TOVAL Show documentation
Show all versions of TOVAL Show documentation
TOVAL comprises a set of java classes for common programming issues. It includes utils for arrays, lists, sets and collections for convenient handling and modification, but also support for mathematic definitions concerning logic (clauses + resolution) together with some algorithms for permutations, powersets and resolution. Additionally it contains a number of types for multisets, matrices with object keys and much more.
The newest version!
package de.invation.code.toval.misc;
import de.invation.code.toval.types.HashList;
import java.util.List;
import java.util.Map;
public class MapUtils {
/**
* String for value separation.
* Used for generating String representations of collections.
*/
public static final char VALUE_MAPPING = '=';
/**
* String for value separation.
* Used for generating String representations of collections.
*/
public static final char VALUE_SEPARATION = ' ';
/**
* Default precision used for String representations of map elements having
* type Float or Double.
*/
public static final int DEFAULT_PRECISION = 2;
/**
* String representation for empty maps.
*/
public static final String EMPTY_MAP = "[]";
public static String toString(Map, ?> map) {
return toString(map, DEFAULT_PRECISION, DEFAULT_PRECISION);
}
public static String toString(Map, ?> map, int precision) {
return toString(map, precision, precision);
}
public static String toString(Map, ?> map, int keyPrecision, int valuePrecision) {
if (map == null)
throw new NullPointerException();
if (map.isEmpty())
return EMPTY_MAP;
List © 2015 - 2025 Weber Informatics LLC | Privacy Policy