Package datomic
Class Util
- java.lang.Object
-
- datomic.Util
-
public final class Util extends java.lang.Object
Utilities for creating and using data structures.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List
list(java.lang.Object... items)
Creates an immutable List.static java.util.Map
map(java.lang.Object... keyvals)
Creates an immutable Map.static java.lang.String
name(java.lang.Object k)
Returns the name part of a keyword or symbol.static java.lang.String
namespace(java.lang.Object k)
Returns the namespace part of a keyword or symbol.static java.lang.Object
read(java.lang.String source)
Reads one item from source, returning it.static java.util.List
readAll(java.io.Reader reader)
Reads all the data in reader, returning a List.static java.util.stream.Stream
streamOn(java.lang.Iterable it)
Create a stream on an immutable Iterable.
-
-
-
Method Detail
-
name
public static java.lang.String name(java.lang.Object k)
Returns the name part of a keyword or symbol.- Parameters:
k
- - a keyword or symbol- Returns:
- the name
-
namespace
public static java.lang.String namespace(java.lang.Object k)
Returns the namespace part of a keyword or symbol.- Parameters:
k
- - a Keyword- Returns:
- the namespace
-
list
public static java.util.List list(java.lang.Object... items)
Creates an immutable List.- Parameters:
items
- - Objects to be included in the List- Returns:
- an unmodifiable List
-
map
public static java.util.Map map(java.lang.Object... keyvals)
Creates an immutable Map.- Parameters:
keyvals
- - pairs to include in the Map, written as key1, value1, key2, value2, and so on- Returns:
- an unmodifiable Map
-
read
public static java.lang.Object read(java.lang.String source)
Reads one item from source, returning it.- Parameters:
source
- an edn string- Returns:
- the object read
-
readAll
public static java.util.List readAll(java.io.Reader reader)
Reads all the data in reader, returning a List. Closes reader.- Parameters:
reader
- - the edn data to parse.- Returns:
- a List for the parsed data.
-
streamOn
public static java.util.stream.Stream streamOn(java.lang.Iterable it)
Create a stream on an immutable Iterable.- Parameters:
it
- an Iterator- Returns:
- a sequential Stream
-
-