public class OWLAPIStreamUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
OWLAPIStreamUtils.Pair<T>
Class for pairwise partition
|
Modifier and Type | Method and Description |
---|---|
static <T> boolean |
add(Collection<? super T> c,
Stream<T> s) |
static Stream<?> |
allComponents(HasComponents root) |
static <T> Stream<OWLAPIStreamUtils.Pair<T>> |
allPairs(Collection<T> input) |
static Stream<int[]> |
allPairs(int size) |
static <T> Stream<OWLAPIStreamUtils.Pair<T>> |
allPairs(Stream<T> input) |
static <T> List<T> |
asList(Stream<?> s,
Class<T> type) |
static <T> List<T> |
asList(Stream<T> s) |
static <T> List<T> |
asListNullsForbidden(Stream<T> s) |
static <K,V,Q> Map<K,V> |
asMap(Stream<Q> s,
Function<Q,K> key,
Function<Q,V> val) |
static <T,Q> Map<T,Q> |
asMap(Stream<Q> s,
Function<Q,T> f) |
static <T> Set<T> |
asSet(Stream<?> s,
Class<T> type) |
static <T> Set<T> |
asSet(Stream<T> s) |
static <T> Set<T> |
asUnorderedSet(Stream<?> s,
Class<T> type) |
static <T> Set<T> |
asUnorderedSet(Stream<T> s) |
static int |
compareCollections(Collection<? extends OWLObject> set1,
Collection<? extends OWLObject> set2) |
static int |
compareIterators(Iterator<?> set1,
Iterator<?> set2)
Compare iterators element by element (sensitive to order)
|
static int |
compareLists(List<? extends OWLObject> set1,
List<? extends OWLObject> set2)
Check lists for equality (sensitive to order)
|
static int |
compareStreams(Stream<?> set1,
Stream<?> set2)
Compare streams through iterators (sensitive to order)
|
static boolean |
contains(Stream<?> s,
Object o) |
static <T> Stream<T> |
empty()
Annotated wrapper for Stream.empty()
|
static boolean |
equalIterators(Iterator<?> set1,
Iterator<?> set2)
Check iterator contents for equality (sensitive to order)
|
static boolean |
equalStreams(Stream<?> set1,
Stream<?> set2)
Check streams for equality (sensitive to order)
|
static Stream<?> |
flatComponents(HasComponents root) |
static <T> OWLAPIStreamUtils.Pair<T> |
pair(T i,
T j) |
static <T> Stream<OWLAPIStreamUtils.Pair<T>> |
pairs(Collection<T> input) |
static Stream<int[]> |
pairs(int size) |
static <T> Stream<OWLAPIStreamUtils.Pair<T>> |
pairs(Stream<T> input) |
static <T> List<T> |
sorted(Class<T> type,
Collection<? extends T> c) |
static <T> List<T> |
sorted(Class<T> type,
List<? extends T> c) |
static <T> List<T> |
sorted(Class<T> type,
Set<? extends T> c) |
static <T> List<T> |
sorted(Class<T> type,
Stream<? extends T> s) |
static <T> List<T> |
sorted(Class<T> type,
T... c) |
static <T> Stream<T> |
streamFromSorted(Collection<T> c)
A method to be used on collections that are sorted, immutable and do not contain nulls.
|
static <T> Stream<T> |
streamFromSorted(T[] c)
A method to be used on arrays that are sorted and do not contain nulls.
|
public static <T> List<T> sorted(Class<T> type, Stream<? extends T> s)
T
- typetype
- type of the returned arrays
- stream to turn to sorted, duplicate free, no null, listpublic static <T> List<T> sorted(Class<T> type, Collection<? extends T> c)
T
- typetype
- type of the returned arrayc
- collection to turn to sorted, duplicate free, no null, listpublic static <T> List<T> sorted(Class<T> type, List<? extends T> c)
T
- typetype
- type of the returned arrayc
- collection to turn to sorted, duplicate free, no null, listpublic static <T> List<T> sorted(Class<T> type, Set<? extends T> c)
T
- typetype
- type of the returned arrayc
- collection to turn to sorted, duplicate free, no null, list@SafeVarargs public static <T> List<T> sorted(Class<T> type, T... c)
T
- typetype
- type of the returned arrayc
- array to sortpublic static <T> Stream<T> streamFromSorted(Collection<T> c)
T
- typec
- sorted collection of distinct, non null elements; the collection must be immutablepublic static <T> Stream<T> streamFromSorted(T[] c)
T
- typec
- sorted array of distinct, non null elementspublic static <T> Set<T> asSet(Stream<T> s)
T
- types
- stream to turn to set. The stream is consumed by this operation.public static <T> Set<T> asSet(Stream<?> s, Class<T> type)
T
- type of return collections
- stream to turn to set. The stream is consumed by this operation.type
- force return type to be exactly Tpublic static <T> Set<T> asUnorderedSet(Stream<T> s)
T
- types
- stream to turn to set. The stream is consumed by this operation.public static <T> Set<T> asUnorderedSet(Stream<?> s, Class<T> type)
T
- type of return collections
- stream to turn to set. The stream is consumed by this operation.type
- force return type to be exactly Tpublic static <T> List<T> asList(Stream<T> s)
T
- types
- stream to turn to list. The stream is consumed by this operation.public static <T> List<T> asListNullsForbidden(Stream<T> s)
T
- types
- stream to turn to list. The stream is consumed by this operation.public static <T> List<T> asList(Stream<?> s, Class<T> type)
T
- type of return collections
- stream to turn to list. The stream is consumed by this operation.type
- force return type to be exactly Tpublic static <T,Q> Map<T,Q> asMap(Stream<Q> s, Function<Q,T> f)
T
- type of keyQ
- type of input and values
- stream to turn to map. The stream is consumed by this operation.f
- function to create the keypublic static <K,V,Q> Map<K,V> asMap(Stream<Q> s, Function<Q,K> key, Function<Q,V> val)
K
- type of keyV
- type of valueQ
- type of inputs
- stream to turn to map. The stream is consumed by this operation.key
- function to create the keyval
- function to create the valuepublic static boolean contains(Stream<?> s, Object o)
s
- stream to check for containment. The stream is consumed at least partially by this
operationo
- object to searchpublic static <T> boolean add(Collection<? super T> c, Stream<T> s)
T
- types
- stream of elements to addc
- collection to add topublic static int compareCollections(Collection<? extends OWLObject> set1, Collection<? extends OWLObject> set2)
set1
- collection to compareset2
- collection to comparepublic static int compareStreams(Stream<?> set1, Stream<?> set2)
set1
- stream to compareset2
- stream to comparepublic static int compareIterators(Iterator<?> set1, Iterator<?> set2)
set1
- iterator to compareset2
- iterator to comparepublic static boolean equalIterators(Iterator<?> set1, Iterator<?> set2)
set1
- iterator to compareset2
- iterator to comparepublic static boolean equalStreams(Stream<?> set1, Stream<?> set2)
set1
- stream to compareset2
- stream to comparepublic static int compareLists(List<? extends OWLObject> set1, List<? extends OWLObject> set2)
set1
- list to compareset2
- list to comparepublic static <T> Stream<T> empty()
T
- typepublic static Stream<?> allComponents(HasComponents root)
root
- the root for the invisitpublic static Stream<?> flatComponents(HasComponents root)
root
- the root for the invisitpublic static Stream<int[]> pairs(int size)
size
- size of matrixsize
. For input 3,
the values are (1,2), (1,3), (2,3)public static Stream<int[]> allPairs(int size)
size
- size of matrixsize
, excluding main
diagonal. For input 3, the values are (1,2), (1,3), (2,3), (2,1),(3,1), (3,2)public static <T> Stream<OWLAPIStreamUtils.Pair<T>> pairs(Collection<T> input)
T
- typeinput
- collection to partitionl.size()
, where l is the
list corresponding to the input collection. For input of length 3, the values are
(l.get(1),l.get(2)), (l.get(1),l.get(3)), (l.get(2),l.get(3))public static <T> Stream<OWLAPIStreamUtils.Pair<T>> allPairs(Collection<T> input)
T
- typeinput
- collection to partitionl.size()
, where l is
the list corresponding to the input collection, excluding main diagonal. For input 3,
the values are (l.get(1),l.get(2)), (l.get(1),l.get(3)), (l.get(2),l.get(3)),
(l.get(2),l.get(1)),(l.get(3),l.get(1)), (l.get(3),l.get(2))public static <T> Stream<OWLAPIStreamUtils.Pair<T>> pairs(Stream<T> input)
T
- typeinput
- collection to partitionl.size()
, where l is the
list corresponding to the input collection. For input of length 3, the values are
(l.get(1),l.get(2)), (l.get(1),l.get(3)), (l.get(2),l.get(3))public static <T> Stream<OWLAPIStreamUtils.Pair<T>> allPairs(Stream<T> input)
T
- typeinput
- collection to partitionl.size()
, where l is
the list corresponding to the input collection, excluding main diagonal. For input 3,
the values are (l.get(1),l.get(2)), (l.get(1),l.get(3)), (l.get(2),l.get(3)),
(l.get(2),l.get(1)),(l.get(3),l.get(1)), (l.get(3),l.get(2))public static <T> OWLAPIStreamUtils.Pair<T> pair(T i, T j)
T
- typei
- firstj
- secondCopyright © 2020 The University of Manchester. All rights reserved.