public class PVectors
extends java.lang.Object
Constructor and Description |
---|
PVectors() |
Modifier and Type | Method and Description |
---|---|
static <T> org.pcollections.PVector<T> |
empty()
List<String> empty = PVectors.empty();
//or
PVector<String> empty = PVectors.empty();
|
static <T> org.pcollections.PVector<T> |
fromCollection(java.util.Collection<T> values)
Create a PVector from the supplied Colleciton
|
static <T> org.pcollections.PVector<T> |
fromStream(java.util.stream.Stream<T> stream)
Reduce (immutable Collection) a Stream to a PVector
|
static <T> org.pcollections.PVector<T> |
of(T... values)
Construct a PVector from the provided values
|
static <T> org.pcollections.PVector<T> |
singleton(T value)
Construct a PVector containing a single value
|
static <T> Reducer<org.pcollections.PVector<T>> |
toPVector()
PVector<String> list = ReactiveSeq.of("a","b","c").mapReduce(PVectors.toPVector()
//list = ["a","b","c"]
PVector<String> list = PVectors.toPVector().reduce(Stream.of("a","b","c")));
//list = ["a","b","c"]
|
public static <T> org.pcollections.PVector<T> of(T... values)
List<String> list = PVectors.of("a","b","c");
// or
PVector<String> list = PVectors.of("a","b","c");
values
- To add to PVectorpublic static <T> org.pcollections.PVector<T> empty()
List<String> empty = PVectors.empty();
//or
PVector<String> empty = PVectors.empty();
public static <T> org.pcollections.PVector<T> singleton(T value)
List<String> single = PVectors.singleton("1");
//or
PVector<String> single = PVectors.singleton("1");
value
- Single value for PVectorpublic static <T> org.pcollections.PVector<T> fromCollection(java.util.Collection<T> values)
PVector<Integer> list = PVectors.fromCollection(Arrays.asList(1,2,3));
values
- to add to new PVectorpublic static <T> org.pcollections.PVector<T> fromStream(java.util.stream.Stream<T> stream)
PVector<Integer> list = PVectors.fromStream(Stream.of(1,2,3));
//list = [1,2,3]
stream
- to convert to a PVectorpublic static <T> Reducer<org.pcollections.PVector<T>> toPVector()
PVector<String> list = ReactiveSeq.of("a","b","c").mapReduce(PVectors.toPVector()
//list = ["a","b","c"]
PVector<String> list = PVectors.toPVector().reduce(Stream.of("a","b","c")));
//list = ["a","b","c"]