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

4
LINES

< > BotCompany Repo | #1025313 // first_warnIfMultiple - get first element of list; warn() when more than one element

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

Libraryless. Click here for Pure Java version (2142L/14K).

static <A> A first_warnIfMultiple(Collection<A> l) {
  if (l(l) > 1) warn("Unexpected multitude: " + l);
  ret first(l);
}

Author comment

Began life as a copy of #1015727

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1025313
Snippet name: first_warnIfMultiple - get first element of list; warn() when more than one element
Eternal ID of this version: #1025313/1
Text MD5: 5ce1bbf4d2b3c0d08f92830d85956062
Transpilation MD5: 3ac7736bbb9c7955ba0114ee082c7b2a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-21 21:59:22
Source code size: 125 bytes / 4 lines
Pitched / IR pitched: No / No
Views / Downloads: 280 / 332
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)