I have few string values and on basis of that string I need to download few files. What will be most efficient way of doing this in java8.
List<String> keyValues = Arrays.asList("key1", "key2", "key3","key4");
keyValues.stream().forEach(i -> (FileUtils.copyURLToFile(new URL(urlStr + i), new File(filePath + i))) );
forEach is giving error as " is not applicable for the arguments (( i) -> {})"
Any help is highly appreciated. Thanks.