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

1  
static L<ConceptShadow> filterConceptShadows(L<ConceptShadow> l1, L<ConceptShadow> l2) {
2  
  new L<ConceptShadow> out;
3  
  int i1 = 0, i2 = 0;
4  
  while (i1 < l(l1) && i2 < l(l2)) {
5  
    ConceptShadow s1 = l1.get(i1), s2 = l2.get(i2);
6  
    long id1 = s1.id(), id2 = s2.id();
7  
    if (id1 == id2)
8  
      out.add(s1);
9  
    else if (id1 < id2)
10  
      ++i1;
11  
    else
12  
      ++i2;
13  
  }
14  
  ret out;
15  
}

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: 157 / 217
Version history: 2 change(s)
Referenced in: [show references]