T
- Type of resultpublic final class SyncScalar<T> extends Object implements Scalar<T>
This class implements Scalar
, which throws a checked
Exception
. This may not be convenient in many cases. To make
it more convenient and get rid of the checked exception you can
use UncheckedScalar
or IoCheckedScalar
decorators.
final List<Integer> list = new LinkedList<>(); final int threads = 100; new RunsInThreads<>( new SyncScalar<>(() -> list.add(1)), threads ); // list.size() will be equal to threads value
Objects of this class are thread-safe.
Scalar.NoNulls<T>
Constructor and Description |
---|
SyncScalar(Scalar<T> src)
Ctor.
|
SyncScalar(Scalar<T> scalar,
Object lock)
Ctor.
|
Copyright © 2017–2018 Cactoos. All rights reserved.