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).

// MetaTransformer that understands Collection (will convert to List) and Map
static MetaTransformer metaTransformer_collectionAndMap() {
  ret new MetaTransformer(new MetaTransformer.StructureHandler() {
    public O transform(O o, IF1 recurse) {
      if (o cast Cl)
        ret map_ping(recurse, o);
      if (o cast Map)
        ret mapKeysAndValues(recurse, o);
      null;
    }
    
    public void visit(O o, IVF1 recurse) {
      if (o cast Cl)
        for ping (O x : o)
          recurse.get(x);
      else if (o cast Map)
        for ping (O x, O y : (Map<O>) o) {
          recurse.get(x);
          recurse.get(y);
        }
    }
  });
}

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: 201 / 277
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1031752 - MTSH_nonTransientFields - visitor only