public class CollectionFactory extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CollectionFactory.ConditionalCopySet<T>
a set implementation that uses a delegate collection for all read-only
operations and makes a copy if changes are attempted.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> Set<T> |
copy(Collection<T> source) |
static <T> Set<T> |
copyMutable(Collection<T> source) |
static <T> Set<T> |
createLinkedSet() |
static <T> List<T> |
createList() |
static <T> List<T> |
createList(T... elements) |
static <K,V> Map<K,V> |
createMap() |
static <T> Set<T> |
createSet() |
static <T> Set<T> |
createSet(Collection<T> c) |
static <T> Set<T> |
createSet(int initialCapacity) |
static <T> Set<T> |
createSet(T... elements) |
static <T> Set<T> |
createSet(T element) |
static <T> List<T> |
createSyncList() |
static <K,V> ConcurrentHashMap<K,V> |
createSyncMap() |
static <T> Set<T> |
createSyncSet() |
static <K,V> Map<K,WeakReference<V>> |
createSyncWeakMap() |
static <T> Set<T> |
getCopyOnRequestSet(Collection<T> source) |
static <T> Set<T> |
getCopyOnRequestSetFromImmutableCollection(Collection<T> source) |
static <T> Set<T> |
getCopyOnRequestSetFromMutableCollection(Collection<T> source) |
static int |
getExpectedThreads() |
static <T> List<T> |
list(Iterable<T> i) |
static <T> List<T> |
list(T... i) |
static <T> List<T> |
list(T i) |
static void |
setExpectedThreads(int value) |
static <T extends OWLObject> |
sortOptionally(Collection<T> toReturn)
Sort a copy of the input collection; if the ordering is unstable and an
error is thrown (due to the use of TimSort in JDK 1.7 and newer), catch
it and leave the collection unsorted.
|
static <T extends OWLObject> |
sortOptionally(List<? extends T> toReturn,
Class<T> desiredType)
Sort the input collection; if the ordering is unstable and an error is
thrown (due to the use of TimSort in JDK 1.7 and newer), catch it and
leave the collection unsorted.
|
static <T extends OWLObject> |
sortOptionally(List<T> toReturn)
Sort the input collection; if the ordering is unstable and an error is
thrown (due to the use of TimSort in JDK 1.7 and newer), catch it and
leave the collection unsorted.
|
static <T extends OWLObject> |
sortOptionally(java.util.stream.Stream<? extends T> toReturn,
Class<T> desiredType)
Sort a copy of the input collection; if the ordering is unstable and an
error is thrown (due to the use of TimSort in JDK 1.7 and newer), catch
it and leave the collection unsorted.
|
static <T extends OWLObject> |
sortOptionally(java.util.stream.Stream<T> toReturn)
Sort a copy of the input collection; if the ordering is unstable and an
error is thrown (due to the use of TimSort in JDK 1.7 and newer), catch
it and leave the collection unsorted.
|
static <T extends OWLObject> |
sortOptionallyComparables(Collection<T> toReturn)
Sort a copy of the input collection; if the ordering is unstable and an
error is thrown (due to the use of TimSort in JDK 1.7 and newer), catch
it and leave the collection unsorted.
|
static <T extends OWLObject> |
sortOptionallyComparables(List<T> toReturn)
Sort the input collection; if the ordering is unstable and an error is
thrown (due to the use of TimSort in JDK 1.7 and newer), catch it and
leave the collection unsorted.
|
public static <T extends OWLObject> List<T> sortOptionallyComparables(List<T> toReturn)
T - list typetoReturn - list to sortpublic static <T extends OWLObject> List<T> sortOptionally(List<T> toReturn)
toReturn - list to sortpublic static <T extends OWLObject> List<T> sortOptionally(List<? extends T> toReturn, Class<T> desiredType)
toReturn - list to sortdesiredType - witness for return typepublic static <T extends OWLObject> List<T> sortOptionallyComparables(Collection<T> toReturn)
T - list typetoReturn - collection to sortpublic static <T extends OWLObject> List<T> sortOptionally(Collection<T> toReturn)
T - list typetoReturn - collection to sortpublic static <T extends OWLObject> List<T> sortOptionally(java.util.stream.Stream<T> toReturn)
T - list typetoReturn - collection to sortpublic static <T extends OWLObject> List<T> sortOptionally(java.util.stream.Stream<? extends T> toReturn, Class<T> desiredType)
T - list typetoReturn - collection to sortdesiredType - witness for return typepublic static void setExpectedThreads(int value)
value - the number of expected threads that will access threadsafe
collections; useful for increasing the concurrency in
ConcurrentHashMapspublic static int getExpectedThreads()
public static <T> Set<T> createSet()
T - axiom typepublic static <T> Set<T> createLinkedSet()
T - axiom typepublic static <T> List<T> createList()
T - axiom type@SafeVarargs public static <T> List<T> createList(T... elements)
T - axiom typeelements - values to add to the listpublic static <T> List<T> createSyncList()
T - content typepublic static <T> List<T> list(Iterable<T> i)
T - typei - iterable@SafeVarargs public static <T> List<T> list(T... i)
T - typei - iterablepublic static <T> List<T> list(T i)
T - typei - iterablepublic static <T> Set<T> createSet(Collection<T> c)
T - axiom typec - values to add to the setpublic static <T> Set<T> createSet(int initialCapacity)
T - axiom typeinitialCapacity - initial capacity for the new setpublic static <K,V> Map<K,V> createMap()
K - key typeV - value typepublic static <K,V> Map<K,WeakReference<V>> createSyncWeakMap()
K - key typeV - value type@SafeVarargs public static <T> Set<T> createSet(T... elements)
T - axiom typeelements - values to add to the setpublic static <T> Set<T> createSet(T element)
T - axiom typeelement - value to add to the setpublic static <T> Set<T> createSyncSet()
T - set typepublic static <K,V> ConcurrentHashMap<K,V> createSyncMap()
K - key typeV - value typepublic static <T> Set<T> getCopyOnRequestSet(Collection<T> source)
T - axiom typesource - the collection to lazily copypublic static <T> Set<T> getCopyOnRequestSetFromMutableCollection(@Nullable Collection<T> source)
T - axiom typesource - source collectionpublic static <T> Set<T> copy(@Nullable Collection<T> source)
T - axiom typesource - the source collection, expected to be immutablepublic static <T> Set<T> copyMutable(@Nullable Collection<T> source)
T - axiom typesource - the source collection, expected to be mutable; the backing list is
created immediatelypublic static <T> Set<T> getCopyOnRequestSetFromImmutableCollection(@Nullable Collection<T> source)
T - axiom typesource - the source collection, expected to be immutableCopyright © 2017 The University of Manchester. All Rights Reserved.