Skip to content

Latest commit

 

History

History
20 lines (18 loc) · 704 Bytes

File metadata and controls

20 lines (18 loc) · 704 Bytes

#list-concurrent-processor

Iterates over a list concurrently while processing each item in parallel

##Example usage Takes a list of Foo objects, for every object, it multiplies the value in with 10 and writes the result to out. This example employs 100 threads for this operation. The custom logic is implemented in the Consumer interface. ###Foo.java: public class Foo { public int in; public int out; } ###processor: ListConcurrentProcessor lcp = new QueueListConcurrentProcessor(listOfFoos, 100); lcp.processList(new Consumer() { @Override public void consume(Foo foo) { foo.out = foo.in() * 10; } });