Given an ArrayList<String> of filenames with file extension, how can I idiomatically get that same array with all the filenames sans file extension.
There's a lot of ways to do this and I could easily just create a new array but I'm wondering if there's a nice clean way to do this with a one-liner.
For now I am doing like so:
List<String> namesWithExt = ...
List<String> namesWithoutExt = new ArrayList<>();
namesWithExt.forEach(name -> namesWithoutExt.add(FilenameUtils.removeExtension(name)));
String[] namesWithoutExt = namesWithExt.toArray(String[]::new);