Libraryless. Click here for Pure Java version (2742L/16K).
1 | static S[] dropFirst(int n, S[] a) {
|
2 | return drop(n, a); |
3 | } |
4 | |
5 | static S[] dropFirst(S[] a) {
|
6 | return drop(1, a); |
7 | } |
8 | |
9 | static O[] dropFirst(O[] a) {
|
10 | return drop(1, a); |
11 | } |
12 | |
13 | static <A> L<A> dropFirst(L<A> l) {
|
14 | return dropFirst(1, l); |
15 | } |
16 | |
17 | static <A> L<A> dropFirst(int n, Iterable<A> i) { ret dropFirst(n, toList(i)); }
|
18 | static <A> L<A> dropFirst(Iterable<A> i) { ret dropFirst(toList(i)); }
|
19 | |
20 | static <A> L<A> dropFirst(int n, L<A> l) {
|
21 | ret n <= 0 ? l : new ArrayList(l.subList(Math.min(n, l.size()), l.size())); |
22 | } |
23 | |
24 | static <A> L<A> dropFirst(L<A> l, int n) {
|
25 | ret dropFirst(n, l); |
26 | } |
27 | |
28 | static S dropFirst(int n, S s) { ret substring(s, n); }
|
29 | static S dropFirst(S s, int n) { ret substring(s, n); }
|
30 | static S dropFirst(S s) { ret substring(s, 1); }
|
31 | |
32 | ifclass Chain |
33 | static <A> Chain<A> dropFirst(Chain<A> c) {
|
34 | ret c?.next; |
35 | } |
36 | endif |
Began life as a copy of #1000705
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
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/9 |
| Text MD5: | 30ca02e7874999c51cc740aec90bf1e4 |
| Transpilation MD5: | 18c7f72eace428e44ffaf59b2888865f |
| Author: | stefan |
| Category: | |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-02-25 21:57:32 |
| Source code size: | 857 bytes / 36 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1773 / 2267 |
| Version history: | 8 change(s) |
| Referenced in: | [show references] |