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

6
LINES

< > BotCompany Repo | #1028176 - addAndReturnIndex - add to list and return index of new element

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

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

static <A> int addAndReturnIndex(L<A> l, A a) {
  if (l == null) ret -1;
  int idx = l.size();
  l.add(a);
  ret idx;
}

Author comment

Began life as a copy of #1017186

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: #1028176
Snippet name: addAndReturnIndex - add to list and return index of new element
Eternal ID of this version: #1028176/1
Text MD5: 6d31417799a3745e84c4a06ea0233882
Transpilation MD5: 852ddffe161fecf247dd94a4c5ba317e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-25 13:55:40
Source code size: 124 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 70 / 128
Referenced in: [show references]