I have a list with values and I want to call a function using executor service with that list the function has only single parameter string. For example I have -
private List<String> namesList = new ArrayList<>();
private ExecutorService exeService = Executors.newFixedThreadPool(10);
private void printNames(String name);
I want to call this function printNames using list values in parallel with executor service i.e if my list has size of 10 then this function should be called parallelly for that list data.
Can it be done inputs will be very helpful ?
for(String s1: nameList) { exeService.submit(() -> { runBatch(s1); }); }