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

25
LINES

< > BotCompany Repo | #1031068 // diffConceptShadows

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

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

1  
static L<CreatedDeletedChanged<ConceptShadow>> diffConceptShadows(L<ConceptShadow> l1, L<ConceptShadow> l2) {
2  
  new L<CreatedDeletedChanged<ConceptShadow>> diffs;
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  
      diffs.add(new CreatedDeletedChanged.Deleted(s1));
9  
      ++i1;
10  
    } else if (id1 > id2) {
11  
      diffs.add(new CreatedDeletedChanged.Created(s2));
12  
      ++i2;
13  
    } else {
14  
      if (!eq(s1, s2))
15  
        diffs.add(new CreatedDeletedChanged.Changed(s1, s2));
16  
      ++i1;
17  
      ++i2;
18  
    }
19  
  }
20  
  while (i1 < l(l1))
21  
    diffs.add(new CreatedDeletedChanged.Deleted(l1.get(i1++)));
22  
  while (i2 < l(l2))
23  
    diffs.add(new CreatedDeletedChanged.Created(l2.get(i2++)));
24  
  ret diffs;
25  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1031068
Snippet name: diffConceptShadows
Eternal ID of this version: #1031068/2
Text MD5: 13a8f3c1a93a86c2acbe0b7243028365
Transpilation MD5: 56538d6ede8d274ed3a67f984901b9c8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-04-26 18:23:43
Source code size: 838 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 191 / 258
Version history: 1 change(s)
Referenced in: [show references]