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

30
LINES

< > BotCompany Repo | #1000798 - dropFirst function (drop first elements of array or chars of string - synonym of "drop")

JavaX fragment (include)

static S[] dropFirst(int n, S[] a) {
  return drop(n, a);
}

static S[] dropFirst(S[] a) {
  return drop(1, a);
}

static O[] dropFirst(O[] a) {
  return drop(1, a);
}

static <A> L<A> dropFirst(L<A> l) {
  return dropFirst(1, l);
}

static <A> L<A> dropFirst(int n, Iterable<A> i) { ret dropFirst(n, toList(i)); }
static <A> L<A> dropFirst(Iterable<A> i) { ret dropFirst(toList(i)); }

static <A> L<A> dropFirst(int n, L<A> l) {
  ret n <= 0 ? l : new ArrayList(l.subList(Math.min(n, l.size()), l.size()));
}

static <A> L<A> dropFirst(L<A> l, int n) {
  ret dropFirst(n, l);
}

static S dropFirst(int n, S s) { ret substring(s, n); }
static S dropFirst(S s, int n) { ret substring(s, n); }
static S dropFirst(S s) { ret substring(s, 1); }

Author comment

Began life as a copy of #1000705

download  show line numbers  debug dex   

Travelled to 11 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1000798
Snippet name: dropFirst function (drop first elements of array or chars of string - synonym of "drop")
Eternal ID of this version: #1000798/7
Text MD5: a634be5d490049877ffd1b2ea1b977ed
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-23 17:13:11
Source code size: 769 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 538 / 654
Version history: 6 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1000798 & http://1000798.tinybrain.de