-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy patharray-script.js
More file actions
executable file
·41 lines (30 loc) · 902 Bytes
/
Copy patharray-script.js
File metadata and controls
executable file
·41 lines (30 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env jjs
print("Arrays");
var jsArray = [4,1,3,2];
jsArray.forEach(function(el) { print(el) } );
//jsArray.forEach((el) => { print(el); } )
print("After forEach");
var javaArray = Java.to(jsArray, Java.type("java.lang.Number[]"))
// not possible
//javaArray.forEach(function(el) print(el));
for (var i in javaArray) {
print(javaArray[i]);
}
for each (var el in javaArray) {
print(el);
}
print("List");
var list = java.util.Arrays.asList(jsArray);
print (typeof list.forEach );
print (list.forEach);
for each (var el in list) {
print(el);
}
print("forEach");
//var Consumer = Java.type("java.util.function.Consumer")
//list.forEach(new Consumer({accept: function(el) print(el)}));
//list.forEach(new Consumer(function(el) print(el)));
list.forEach(function(el) { print(el) });
//list.forEach(function(el) print(el));
//list.forEach(el => { print(el } );
print("fertig");