|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectmathCollection.MathCollections
This class consists exclusively of static methods that return mathematical
collections. It contains "wrappers", which return a new synchronized
mathematical collection backed by a specified collection.
The methods of this class all throw a NullPointerException
if the mathematical collections provided to them are null
.
MathCollections.SynchronizedMathSet
,
SetOfSets
,
Multiset
Nested Class Summary | |
(package private) static class |
MathCollections.SynchronizedMathSet
|
(package private) static class |
MathCollections.SynchronizedMultiset
|
(package private) static class |
MathCollections.SynchronizedSetOfSets
|
Constructor Summary | |
private |
MathCollections()
|
Method Summary | |
static MathSet |
synchronizedMathSet(MathSet ms)
Returns a synchronized (thread-safe) mathematical set backed by the specified mathematical set. |
static MathSet |
synchronizedMathSet(MathSet ms,
java.lang.Object mutex)
Same behavior as synchronizedMathSet(MathSet) , but the
mutex that is blocked by method calls can be specified. |
static Multiset |
synchronizedMultiset(Multiset mus)
Returns a synchronized (thread-safe) multiset backed by the specified multiset. |
static Multiset |
synchronizedMultiset(Multiset mus,
java.lang.Object mutex)
Same behavior as synchronizedMultiset(Multiset) , but the
mutex that is blocked by method calls can be specified. |
static SetOfSets |
synchronizedSetOfSets(SetOfSets sos)
Returns a synchronized (thread-safe) set of sets backed by the specified set of sets. |
static SetOfSets |
synchronizedSetOfSets(SetOfSets sos,
java.lang.Object mutex)
Same behavior as synchronizedSetOfSets(SetOfSets) , but
the mutex that is blocked by method calls can be specified. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
private MathCollections()
Method Detail |
public static MathSet synchronizedMathSet(MathSet ms)
It is imperative that the user manually synchronize on the returned mathematical set when iterating over it:
MathSet ms = MathCollections.synchronizedMathSet(new HashMathSet()); ... synchronized (ms) { Iterator i = ms.iterator(); // Must be in the synchronized block while (i.hasNext()) foo(i.next()); }Failure to follow this advice may result in non-deterministic behavior.
The returned mathematical set will be serializable if the specified mathematical set is serializable.
ms
- the mathematical set to be "wrapped" in a synchronized
mathematical set.
synchronizedMathSet(MathSet, java.lang.Object)
public static MathSet synchronizedMathSet(MathSet ms, java.lang.Object mutex)
synchronizedMathSet(MathSet)
, but the
mutex that is blocked by method calls can be specified.
ms
- the mathematical set to be "wrapped" in a synchronized
mathematical set.mutex
- object to be blocked by method calls.
synchronizedMathSet(MathSet)
public static SetOfSets synchronizedSetOfSets(SetOfSets sos)
It is imperative that the user manually synchronize on the returned set of sets when iterating over it:
SetOfSets sos = MathCollections.synchronizedSetOfSets(new HashSetOfSets()); ... synchronized (sos) { Iterator i = sos.iterator(); // Must be in the synchronized block while (i.hasNext()) foo(i.next()); }Failure to follow this advice may result in non-deterministic behavior.
The returned set of sets will be serializable if the specified set of sets is serializable.
sos
- the set of sets to be "wrapped" in a synchronized
set of sets.
synchronizedSetOfSets(SetOfSets, java.lang.Object)
public static SetOfSets synchronizedSetOfSets(SetOfSets sos, java.lang.Object mutex)
synchronizedSetOfSets(SetOfSets)
, but
the mutex that is blocked by method calls can be specified.
sos
- the set of sets to be "wrapped" in a synchronized
set of sets.mutex
- object to be blocked by method calls.
synchronizedSetOfSets(SetOfSets)
public static Multiset synchronizedMultiset(Multiset mus)
It is imperative that the user manually synchronize on the returned multiset when iterating over it:
Multiset mus = MathCollections.synchronizedMultiset(new HashMultiset()); ... synchronized (mus) { Iterator i = mus.iterator(); // Must be in the synchronized block while (i.hasNext()) foo(i.next()); }Failure to follow this advice may result in non-deterministic behavior.
The returned multiset will be serializable if the specified multiset is serializable.
mus
- the multiset to be "wrapped" in a synchronized multiset.
synchronizedMultiset(Multiset, java.lang.Object)
public static Multiset synchronizedMultiset(Multiset mus, java.lang.Object mutex)
synchronizedMultiset(Multiset)
, but the
mutex that is blocked by method calls can be specified.
mus
- the multiset to be "wrapped" in a synchronized multiset.mutex
- object to be blocked by method calls.
synchronizedMultiset(Multiset)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |