|
Neo4j Community | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.neo4j.helpers.collection.MapUtil
public abstract class MapUtil
Utility to create Map
s.
Constructor Summary | |
---|---|
MapUtil()
|
Method Summary | ||
---|---|---|
static
|
genericMap(Map<K,V> targetMap,
Object... objects)
A short-hand method for adding key/value pairs into a Map . |
|
static
|
genericMap(Object... objects)
A short-hand method for creating a Map of key/value pairs. |
|
static Map<String,String> |
load(File file)
Loads a Map from a File assuming strings as keys
and values. |
|
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)
Loads a Map from a Reader assuming strings as keys
and values. |
|
static Map<String,String> |
loadStrictly(File file)
Loads a Map from a File assuming strings as keys
and values. |
|
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)
Loads a Map from a Reader assuming strings as keys
and values. |
|
static Map<String,Object> |
map(Map<String,Object> targetMap,
Object... objects)
A short-hand method for creating a Map of key/value pairs where
keys are String s and values are Object s. |
|
static Map<String,Object> |
map(Object... objects)
A short-hand method for creating a Map of key/value pairs where
keys are String s and values are Object s. |
|
static
|
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)
Stores the data in config into file in a standard java
Properties format. |
|
static void |
store(Map<String,String> config,
OutputStream stream)
Stores the data in config into stream in a standard java
Properties format. |
|
static void |
store(Map<String,String> config,
Writer writer)
Stores the data in config into writer in a standard java
Properties format. |
|
static void |
storeStrictly(Map<String,String> config,
File file)
Stores the data in config into file in a standard java
Properties format. |
|
static void |
storeStrictly(Map<String,String> config,
OutputStream stream)
Stores the data in config into stream in a standard java
Properties format. |
|
static void |
storeStrictly(Map<String,String> config,
Writer writer)
Stores the data in config into writer in a standard java
Properties format. |
|
static Map<String,String> |
stringMap(Map<String,String> targetMap,
String... strings)
A short-hand method for creating a Map of key/value pairs where
both keys and values are String s. |
|
static Map<String,String> |
stringMap(String... strings)
A short-hand method for creating a Map of key/value pairs where
both keys and values are String s. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MapUtil()
Method Detail |
---|
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)
Map
of key/value pairs where
both keys and values are String
s.
strings
- alternating key and value.
strings
.public static Map<String,String> stringMap(Map<String,String> targetMap, String... strings)
Map
of key/value pairs where
both keys and values are String
s.
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 String
s and values are Object
s.
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 String
s and values are Object
s.
targetMap
- the Map
to put the objects into.objects
- alternating key and value.
objects
.public static Map<String,String> load(Reader reader) throws IOException
Map
from a Reader
assuming strings as keys
and values.
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
Map
from a File
assuming strings as keys
and values.
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
into file
in a standard java
Properties
format.
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
into stream
in a standard java
Properties
format.
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
into writer
in a standard java
Properties
format.
config
- the data to store in the properties file.stream
- 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.stream
- 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.
|
Neo4j Community | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |