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

53
LINES

< > BotCompany Repo | #1000705 // drop function (drop first elements of array, also antiFilter)

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

Libraryless. Click here for Pure Java version (9472L/52K).

1  
static String[] drop(int n, String[] a) {
2  
  n = Math.min(n, a.length);
3  
  String[] b = new String[a.length-n];
4  
  System.arraycopy(a, n, b, 0, b.length);
5  
  return b;
6  
}
7  
8  
static Object[] drop(int n, Object[] a) {
9  
  n = Math.min(n, a.length);
10  
  Object[] b = new Object[a.length-n];
11  
  System.arraycopy(a, n, b, 0, b.length);
12  
  return b;
13  
}
14  
15  
static <A> L<A> drop(Iterable<A> c, O pred) {
16  
  ret antiFilter(c, pred);
17  
}
18  
19  
20  
21  
static L lambdaMapLike drop(O pred, Iterable c) {
22  
  ret antiFilter(pred, c);
23  
}
24  
25  
26  
27  
static L drop(O pred, O[] c) {
28  
  ret antiFilter(pred, c);
29  
}
30  
31  
32  
33  
static <A, B extends A> L<B> drop(Iterable<B> c, F1<A, Bool> pred) {
34  
  ret antiFilter(c, pred);
35  
}
36  
37  
38  
39  
static <A, B extends A> L<B> drop(F1<A, Bool> pred, Iterable<B> c) {
40  
  ret antiFilter(pred, c);
41  
}
42  
43  
44  
45  
static <A, B extends A> L<B> drop(Iterable<B> c, IF1<A, Bool> pred) {
46  
  ret antiFilter(c, pred);
47  
}
48  
49  
50  
51  
static <A, B extends A> L<B> drop(IF1<A, Bool> pred, Iterable<B> c) {
52  
  ret antiFilter(pred, c);
53  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, uelavcdoioby, vouqrxazstgt

No comments. add comment

Snippet ID: #1000705
Snippet name: drop function (drop first elements of array, also antiFilter)
Eternal ID of this version: #1000705/4
Text MD5: 32e0ab3ad3a6e01b51bd22d9ad5fc9ce
Transpilation MD5: eec5716d1a3eb5d98b61ccd852173f08
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-27 01:31:54
Source code size: 1011 bytes / 53 lines
Pitched / IR pitched: No / No
Views / Downloads: 726 / 1350
Version history: 3 change(s)
Referenced in: [show references]