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

23
LINES

< > BotCompany Repo | #1031054 // metaTransformer_collectionAndMap

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3023L/18K).

1  
// MetaTransformer that understands Collection (will convert to List) and Map
2  
static MetaTransformer metaTransformer_collectionAndMap() {
3  
  ret new MetaTransformer(new MetaTransformer.StructureHandler() {
4  
    public O transform(O o, IF1 recurse) {
5  
      if (o cast Cl)
6  
        ret map_ping(recurse, o);
7  
      if (o cast Map)
8  
        ret mapKeysAndValues(recurse, o);
9  
      null;
10  
    }
11  
    
12  
    public void visit(O o, IVF1 recurse) {
13  
      if (o cast Cl)
14  
        for ping (O x : o)
15  
          recurse.get(x);
16  
      else if (o cast Map)
17  
        for ping (O x, O y : (Map<O>) o) {
18  
          recurse.get(x);
19  
          recurse.get(y);
20  
        }
21  
    }
22  
  });
23  
}

Author comment

Began life as a copy of #1027775

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031054
Snippet name: metaTransformer_collectionAndMap
Eternal ID of this version: #1031054/4
Text MD5: 624bafbf096f7a151c8763853e62b45c
Transpilation MD5: 9ecf1e1d0a6d6016ca428c36c8c35d24
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-04-26 16:27:58
Source code size: 674 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 202 / 280
Version history: 3 change(s)
Referenced in: [show references]