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

15
LINES

< > BotCompany Repo | #1031075 // filterConceptShadows - only retain elements of first list which are in second list (by id)

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

Libraryless. Click here for Pure Java version (15846L/102K).

static L<ConceptShadow> filterConceptShadows(L<ConceptShadow> l1, L<ConceptShadow> l2) {
  new L<ConceptShadow> out;
  int i1 = 0, i2 = 0;
  while (i1 < l(l1) && i2 < l(l2)) {
    ConceptShadow s1 = l1.get(i1), s2 = l2.get(i2);
    long id1 = s1.id(), id2 = s2.id();
    if (id1 == id2)
      out.add(s1);
    else if (id1 < id2)
      ++i1;
    else
      ++i2;
  }
  ret out;
}

Author comment

Began life as a copy of #1031068

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1031075
Snippet name: filterConceptShadows - only retain elements of first list which are in second list (by id)
Eternal ID of this version: #1031075/3
Text MD5: 977b0cedae16b6aa4720dc1007082134
Transpilation MD5: a3e59f7886e288ff8fb08f22746b541d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-04-29 23:40:39
Source code size: 393 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 93 / 142
Version history: 2 change(s)
Referenced in: [show references]