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

17
LINES

< > BotCompany Repo | #1008440 // allEq

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

Libraryless. Click here for Pure Java version (5016L/28K).

1  
static bool allEq(O... l) {
2  
  if (empty(l)) true;
3  
  int n = l(l);
4  
  O o = l[0];
5  
  for (int i = 1; i < n; i++)
6  
    if (neq(l[i], o)) false;
7  
  true;
8  
}
9  
10  
static <A> bool allEq(Iterable<A> l) {
11  
  var it = iterator(l);
12  
  if (!it.hasNext()) true;
13  
  A o = it.next();
14  
  while (it.hasNext())
15  
    if (neq(it.next(), o)) false;
16  
  true;
17  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008440
Snippet name: allEq
Eternal ID of this version: #1008440/4
Text MD5: 7980436d7d87c8175f2f7ef37f19e361
Transpilation MD5: f83028751ad8235e7dc86b983ce4e953
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-11 21:06:09
Source code size: 341 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 581 / 651
Version history: 3 change(s)
Referenced in: [show references]