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

11
LINES

< > BotCompany Repo | #1029322 // compareCharIterators_maxLen

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

Libraryless. Click here for Pure Java version (41L/1K).

1  
static int compareCharIterators_maxLen(CharacterIterator it1, CharacterIterator it2, int n) {
2  
  for i to n: {
3  
    if (!it1.hasNext())
4  
      ret it2.hasNext() ? -1 : 0;
5  
    if (!it2.hasNext()) ret 1;
6  
    char a = it1.next(), b = it2.next();
7  
    if (a < b) ret -1;
8  
    if (a > b) ret 1;
9  
  }
10  
  ret 0;
11  
}

Author comment

Began life as a copy of #1029161

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1029322
Snippet name: compareCharIterators_maxLen
Eternal ID of this version: #1029322/1
Text MD5: d512132676ae6d964d98c5090d2cdffa
Transpilation MD5: 24d4ed5cc3982bb058518fedef8bbcb8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-30 21:54:17
Source code size: 309 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 127 / 184
Referenced in: [show references]