How i can write this code in Java 8?
for (Iterator<RecordVo> iterator = list.iterator(); iterator.hasNext();) {
RecordVo recordVo = (RecordVo) iterator.next();
ExecutionContext singleThreadExecutionContext = new ExecutionContext();
singleThreadExecutionContext.put("customerId", recordVo.getCustomerId());
singleThreadExecutionContext.put("ThreadName", "Thread-"+recordVo.getCustomerId());
multiThreadExecutionContext.put("Partition - "+recordVo.getCustomerId(), singleThreadExecutionContext);
}
for(each : ofList)here than from streams, and that's Java 6.list.forEach(recordVo->multiThreadExecutionContext.put("Partition - "+recordVo.getCustomerId(),new ExecutionContext().put("customerId", recordVo.getCustomerId())));