I’d like to do something similar to
Collection.removeAll(Set);
but I’m using a List<File> and Set<long>
I’ve got a List of Files, and I’d like to remove any file from the list that contains one of the longs in my set as part of the filename. I know I can do that if I iterate through the List of Files and do a compare to each entry in the set. But that sounds horribly inefficient.
Again, I’d like to create a List of Files that does NOT contain any of the longs in my Set as part of the filename.
(for example)
List<File> filesFromDirectory;
filesFromDirectory.add(new File("first.123.file"));
filesFromDirectory.add(new File("second.456.file"));
Set<Long> fnameVals = HashSet<Long>();
fnameVals.add(456);
…
I’d like the result to be:
System.out.println(filesFromDirectory);
first.123.file
Disclaimer: I haven’t written Java in aaaaages. This probably won’t compile.