Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1021831 // subMapStartingWith_dropPrefix - not optimized for TreeMaps

JavaX fragment (include)

1  
static <T> Map<S, T> subMapStartingWith_dropPrefix(Map<S, T> map, S prefix) {
2  
  if (map == null) null;
3  
  new Map<S, T> map2;
4  
  for (S key, T value : map) {
5  
    if (startsWith(key, prefix))
6  
      map2.put(substring(key, l(prefix)), value);
7  
  }
8  
  ret map2;
9  
}

Author comment

Began life as a copy of #1004369

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021831
Snippet name: subMapStartingWith_dropPrefix - not optimized for TreeMaps
Eternal ID of this version: #1021831/1
Text MD5: 8a61e8e0b21c39896b16c016167ed6fe
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-01 11:32:49
Source code size: 264 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 301 / 343
Referenced in: [show references]