I came accross this problem today:
I have a HashMap<String, String>, and I want to sort out entries selectively by key, that is, only keys which start with ~ should remain (and the ~s should be removed in the process).
My first thought was to get some queue object from the keys, process them and call remove(key) on the hashmap. but this seems rather slow to me and it's not possible to remove the ~s in front of all keys in the process. :\
How would you do this? I'm not quite sure - especially about performance aspects - on this one >_>