Interface Accumulator<T>
- Type Parameters:
T- the type
- All Superinterfaces:
Consumer<T>
- All Known Implementing Classes:
CallbackAccumulator, ListAccumulator, SetAccumulator, SetAccumulatorWrapper, SizeRestrictedAccumulatorWrapper
The interface provides a mechanism for clients to pass around an object that is effectively
a 'results object', into which data can be placed as it is discovered.
Historically, clients that load data will return results, once fully loaded, in a
Collection. This has the drawback that the discovered data cannot be used until
all searching is complete. This interface can now be passed into such a method (as opposed
to be returned by it) so that the client can make use of data as it is discovered. This
allows for long searching processes to report data as they work.
Using this class implies that data will be added asynchronously. Implementations of this interface should properly synchronize storage so that the data written is visible to the client thread.
-
Method Summary
ChangeModifier and TypeMethodDescriptiondefault voidvoidvoidaddAll(Collection<T> collection) intReturns the number of items that have been added to this accumulator.REMOVEDbooleancontains(T t) RemovedREMOVEDCollection<T>get() RemovedREMOVEDintsize() RemovedREMOVEDbooleanisEmpty() RemovedREMOVEDStream<T>stream() Removed
-
Method Details
-
add
-
addAll
-
getProgress NEW
int getProgress()Returns the number of items that have been added to this accumulator.- Returns:
- the number of items that have been added to this accumulator
-
accept
-