Package ghidra.util.datastruct
Class CallbackAccumulator<T>
- java.lang.Object
-
- ghidra.util.datastruct.CallbackAccumulator<T>
-
- Type Parameters:
T- the type of the item being accumulated
- All Implemented Interfaces:
Accumulator<T>,java.lang.Iterable<T>
public class CallbackAccumulator<T> extends java.lang.Object implements Accumulator<T>
An implementation ofAccumulatorthat allows clients to easily process items as they arrive.This class is different than normal accumulators in that the values are not stored internally. As such, calls to
get(),iterator()andsize()will reflect having no data. Further, to use this class, each client must override#itemAdded(Object)in order to process the data as it arrives.
-
-
Constructor Summary
Constructors Constructor Description CallbackAccumulator(java.util.function.Consumer<T> consumer)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(T t)voidaddAll(java.util.Collection<T> collection)booleancontains(T t)java.util.Collection<T>get()java.util.Iterator<T>iterator()intsize()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ghidra.util.datastruct.Accumulator
isEmpty, stream
-
-
-
-
Constructor Detail
-
CallbackAccumulator
public CallbackAccumulator(java.util.function.Consumer<T> consumer)
Constructor- Parameters:
consumer- the consumer that will get called each time an item is addded
-
-
Method Detail
-
add
public void add(T t)
- Specified by:
addin interfaceAccumulator<T>
-
addAll
public void addAll(java.util.Collection<T> collection)
- Specified by:
addAllin interfaceAccumulator<T>
-
contains
public boolean contains(T t)
- Specified by:
containsin interfaceAccumulator<T>
-
get
public java.util.Collection<T> get()
- Specified by:
getin interfaceAccumulator<T>
-
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<T>
-
size
public int size()
- Specified by:
sizein interfaceAccumulator<T>
-
-