Package org.semanticweb.owlapi.util
Class CollectionFactory
java.lang.Object
org.semanticweb.owlapi.util.CollectionFactory
- Since:
- 2.0.0
- Author:
- Matthew Horridge, The University Of Manchester, Bio-Health Informatics Group
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
a set implementation that uses a delegate collection for all read-only operations and makes a copy if changes are attempted. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Set
<T> copy
(Collection<T> source) static <T> Set
<T> copyMutable
(Collection<T> source) static <T> Set
<T> static <T> List
<T> static <T> List
<T> createList
(T... elements) static <K,
V> Map <K, V> static <T> Set
<T> static <T> Set
<T> createSet
(int initialCapacity) static <T> Set
<T> createSet
(Collection<T> c) static <T> Set
<T> createSet
(T element) static <T> Set
<T> createSet
(T... elements) static <T> List
<T> static <K,
V> ConcurrentHashMap <K, V> static <T> Set
<T> static <K,
V> Map <K, WeakReference<V>> static <T> Set
<T> getCopyOnRequestSet
(Collection<T> source) static <T> Set
<T> static <T> Set
<T> static int
static <T> List
<T> static <T> List
<T> list
(T i) static <T> List
<T> list
(T... i) static void
setExpectedThreads
(int value)
-
Method Details
-
getExpectedThreads
public static int getExpectedThreads()- Returns:
- The current number of expected updating threads.
-
setExpectedThreads
public static void setExpectedThreads(int value) - Parameters:
value
- the number of expected threads that will update threadsafe collections; useful for increasing the concurrency in ConcurrentHashMap instances created by this factory
-
createSet
- Type Parameters:
T
- axiom type- Returns:
- fresh non threadsafe set
-
createLinkedSet
- Type Parameters:
T
- axiom type- Returns:
- fresh non threadsafe set
-
createList
- Type Parameters:
T
- axiom type- Returns:
- fresh non threadsafe list
-
createList
- Type Parameters:
T
- axiom type- Parameters:
elements
- values to add to the list- Returns:
- fresh non threadsafe list
-
createSyncList
- Type Parameters:
T
- content type- Returns:
- fresh threadsafe list
-
list
- Type Parameters:
T
- type- Parameters:
i
- iterable- Returns:
- list from iterable
-
list
- Type Parameters:
T
- type- Parameters:
i
- iterable- Returns:
- list from iterable
-
list
- Type Parameters:
T
- type- Parameters:
i
- iterable- Returns:
- list from iterable
-
createSet
- Type Parameters:
T
- axiom type- Parameters:
c
- values to add to the set- Returns:
- fresh non threadsafe set
-
createSet
- Type Parameters:
T
- axiom type- Parameters:
initialCapacity
- initial capacity for the new set- Returns:
- fresh non threadsafe set
-
createMap
- Type Parameters:
K
- key typeV
- value type- Returns:
- fresh map
-
createSyncWeakMap
- Type Parameters:
K
- key typeV
- value type- Returns:
- a new weak HashMap wrapped as a synchronized map
-
createSet
- Type Parameters:
T
- axiom type- Parameters:
elements
- values to add to the set- Returns:
- fresh non threadsafe set
-
createSet
- Type Parameters:
T
- axiom type- Parameters:
element
- value to add to the set- Returns:
- fresh non threadsafe set
-
createSyncSet
- Type Parameters:
T
- set type- Returns:
- fresh threadsafe set
-
createSyncMap
- Type Parameters:
K
- key typeV
- value type- Returns:
- fresh threadsafe HashMap
-
getCopyOnRequestSet
- Type Parameters:
T
- axiom type- Parameters:
source
- the collection to lazily copy- Returns:
- a lazy defensive copy for source; the source collection will not be copied until a method that modifies the collection gets called, e.g., add(), addAll()
-
getCopyOnRequestSetFromMutableCollection
- Type Parameters:
T
- axiom type- Parameters:
source
- source collection- Returns:
- copy on request that builds a list from the input set
-
copy
- Type Parameters:
T
- axiom type- Parameters:
source
- the source collection, expected to be immutable- Returns:
- copy on request that does not build a list immediately
-
copyMutable
- Type Parameters:
T
- axiom type- Parameters:
source
- the source collection, expected to be mutable; the backing list is created immediately- Returns:
- copy on request that builds a list immediately
-
getCopyOnRequestSetFromImmutableCollection
- Type Parameters:
T
- axiom type- Parameters:
source
- the source collection, expected to be immutable- Returns:
- copy on request that does not build a list immediately
-