public class PQueues
extends java.lang.Object
Constructor and Description |
---|
PQueues() |
Modifier and Type | Method and Description |
---|---|
static <T> org.pcollections.PQueue<T> |
empty()
List<String> empty = PQueue.empty();
//or
PQueue<String> empty = PQueue.empty();
|
static <T> org.pcollections.PQueue<T> |
fromCollection(java.util.Collection<T> stream)
List<String> list = PQueues.of(Arrays.asList("a","b","c"));
// or
PQueues<String> list = PQueues.of(Arrays.asList("a","b","c"));
|
static <T> org.pcollections.PQueue<T> |
fromStream(java.util.stream.Stream<T> stream)
Reduce (immutable Collection) a Stream to a PStack, note for efficiency reasons,
the produced PStack is reversed.
|
static <T> org.pcollections.PQueue<T> |
of(T... values)
Construct a PQueue from the provided values
|
static <T> org.pcollections.PQueue<T> |
singleton(T value)
Construct a PQueues containing a single value
|
static <T> Reducer<org.pcollections.PQueue<T>> |
toPQueue()
Return a reducer that can produce a PStack from a Stream, note for efficiency reasons,
the produced PStack will be reversed.
|
public static <T> org.pcollections.PQueue<T> of(T... values)
List<String> q = PQueues.of("a","b","c");
// or
PStack<String> q = PQueues.of("a","b","c");
values
- To add to PQueuepublic static <T> org.pcollections.PQueue<T> empty()
List<String> empty = PQueue.empty();
//or
PQueue<String> empty = PQueue.empty();
public static <T> org.pcollections.PQueue<T> singleton(T value)
List<String> single = PQueues.singleton("1");
//or
PQueues<String> single = PQueues.singleton("1");
value
- Single value for PQueuepublic static <T> org.pcollections.PQueue<T> fromCollection(java.util.Collection<T> stream)
List<String> list = PQueues.of(Arrays.asList("a","b","c"));
// or
PQueues<String> list = PQueues.of(Arrays.asList("a","b","c"));
values
- To add to PQueuepublic static <T> org.pcollections.PQueue<T> fromStream(java.util.stream.Stream<T> stream)
PQueue<Integer> q = PQueues.fromStream(Stream.of(1,2,3));
//queue = [3,2,1]
stream
- to convert to a PVectorpublic static <T> Reducer<org.pcollections.PQueue<T>> toPQueue()
PQueue<String> q = ReactiveSeq.of("a","b","c").mapReduce(PQueues.toPStack()
//queue = ["a","b","c"]
PQueues<String> q = PQueues.toPStack().reduce(Stream.of("a","b","c")));
//queue = ["a","b","c"]