| Constructor and Description |
|---|
MapUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <K> boolean |
approximatelyEqual(Map<K,Double> that,
Map<K,Double> other,
double tolerance) |
static <K,V> Map<K,V> |
copyAndPut(Map<K,V> map,
K key,
V value) |
static <K,V> Map<K,V> |
copyAndRemove(Map<K,V> map,
K key) |
static <K,V> Map<K,V> |
genericMap(Map<K,V> targetMap,
Object... objects)
A short-hand method for adding key/value pairs into a
Map. |
static <K,V> Map<K,V> |
genericMap(Object... objects)
A short-hand method for creating a
Map of key/value pairs. |
static Map<String,String> |
load(File file)
|
static Map<String,String> |
load(InputStream stream)
Loads a
Map from an InputStream assuming strings as keys
and values. |
static Map<String,String> |
load(Reader reader)
|
static Map<String,String> |
loadStrictly(File file)
|
static Map<String,String> |
loadStrictly(InputStream stream)
Loads a
Map from an InputStream assuming strings as keys
and values. |
static Map<String,String> |
loadStrictly(Reader reader)
|
static Map<String,Object> |
map(Map<String,Object> targetMap,
Object... objects)
|
static Map<String,Object> |
map(Object... objects)
|
static <K,V> Map<V,K> |
reverse(Map<K,V> map)
Reversed a map, making the key value and the value key.
|
static void |
store(Map<String,String> config,
File file)
|
static void |
store(Map<String,String> config,
OutputStream stream)
|
static void |
store(Map<String,String> config,
Writer writer)
|
static void |
storeStrictly(Map<String,String> config,
File file)
|
static void |
storeStrictly(Map<String,String> config,
OutputStream stream)
|
static void |
storeStrictly(Map<String,String> config,
Writer writer)
|
static Map<String,String> |
stringMap(Map<String,String> targetMap,
String... strings)
|
static Map<String,String> |
stringMap(String... strings)
|
static <K,V> Map<K,V> |
toMap(Iterable<Pair<K,V>> pairs) |
static <K,V> Map<K,V> |
toMap(Iterator<Pair<K,V>> pairs) |
static Map<String,String> |
toStringMap(PropertyContainer entity) |
public static <K,V> Map<K,V> genericMap(Object... objects)
Map of key/value pairs.K - type of keysV - type of valuesobjects - alternating key and value.objects.public static <K,V> Map<K,V> genericMap(Map<K,V> targetMap, Object... objects)
Map.K - type of keysV - type of valuestargetMap - the Map to put the objects into.objects - alternating key and value.objects.public static Map<String,String> stringMap(String... strings)
strings - alternating key and value.strings.public static Map<String,String> stringMap(Map<String,String> targetMap, String... strings)
targetMap - the Map to put the objects into.strings - alternating key and value.strings.public static Map<String,Object> map(Object... objects)
Map of key/value pairs where
keys are Strings and values are Objects.objects - alternating key and value.objects.public static Map<String,Object> map(Map<String,Object> targetMap, Object... objects)
Map of key/value pairs where
keys are Strings and values are Objects.targetMap - the Map to put the objects into.objects - alternating key and value.objects.public static Map<String,String> load(Reader reader) throws IOException
reader - the Reader containing a Properties-like
layout of keys and values.Map.IOException - if the reader throws IOException.public static Map<String,String> loadStrictly(Reader reader)
Map from a Reader assuming strings as keys
and values. Any IOException is wrapped and thrown as a
RuntimeException instead.reader - the Reader containing a Properties-like
layout of keys and values.Map.public static Map<String,String> load(InputStream stream) throws IOException
Map from an InputStream assuming strings as keys
and values.stream - the InputStream containing a
Properties-like layout of keys and values.Map.IOException - if the stream throws IOException.public static Map<String,String> loadStrictly(InputStream stream)
Map from an InputStream assuming strings as keys
and values. Any IOException is wrapped and thrown as a
RuntimeException instead.stream - the InputStream containing a
Properties-like layout of keys and values.Map.public static Map<String,String> load(File file) throws IOException
file - the File containing a Properties-like
layout of keys and values.Map.IOException - if the file reader throws IOException.public static Map<String,String> loadStrictly(File file)
Map from a File assuming strings as keys
and values. Any IOException is wrapped and thrown as a
RuntimeException instead.file - the File containing a Properties-like
layout of keys and values.Map.public static void store(Map<String,String> config, File file) throws IOException
config - the data to store in the properties file.file - the file to store the properties in.IOException - IO error.public static void storeStrictly(Map<String,String> config, File file)
config into file in a standard java
Properties format. Any IOException is wrapped and thrown as a
RuntimeException instead.config - the data to store in the properties file.file - the file to store the properties in.public static void store(Map<String,String> config, OutputStream stream) throws IOException
config - the data to store in the properties file.stream - the OutputStream to store the properties in.IOException - IO error.public static void storeStrictly(Map<String,String> config, OutputStream stream)
config into stream in a standard java
Properties format. Any IOException is wrapped and thrown as a
RuntimeException instead.config - the data to store in the properties file.stream - the OutputStream to store the properties in.IOException - IO error.public static void store(Map<String,String> config, Writer writer) throws IOException
config - the data to store in the properties file.writer - the Writer to store the properties in.IOException - IO error.public static void storeStrictly(Map<String,String> config, Writer writer)
config into writer in a standard java
Properties format. Any IOException is wrapped and thrown
as a RuntimeException instead.config - the data to store in the properties file.writer - the Writer to store the properties in.IOException - IO error.public static <K,V> Map<V,K> reverse(Map<K,V> map)
K - the type of key in the map to reverse. These will be the
values in the returned map.V - the type of values in the map to revert. These will be the
keys in the returned map.map - the Map to reverse.map. A new Map will be returned
where the keys from map will be the values and the values will
be the keys.public static Map<String,String> toStringMap(PropertyContainer entity)
Copyright © 2002–2015 The Neo4j Graph Database Project. All rights reserved.