File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -48,3 +48,41 @@ list.add('b');
48
48
list . add ( 'c' ) ;
49
49
50
50
for each ( var el in list ) print ( el ) ;
51
+
52
+
53
+ print ( '------------------' ) ;
54
+ print ( 'HashMap:' ) ;
55
+
56
+ var HashMap = Java . type ( 'java.util.HashMap' ) ;
57
+
58
+ var map = new HashMap ( ) ;
59
+ map . put ( 'foo' , 'foo1' ) ;
60
+ map . put ( 'bar' , 'bar1' ) ;
61
+
62
+ for each ( var e in map . keySet ( ) ) print ( e ) ;
63
+
64
+ for each ( var e in map . values ( ) ) print ( e ) ;
65
+
66
+
67
+ print ( '------------------' ) ;
68
+ print ( 'Streams:' ) ;
69
+
70
+ var list2 = new ArrayList ( ) ;
71
+ list2 . add ( "ddd2" ) ;
72
+ list2 . add ( "aaa2" ) ;
73
+ list2 . add ( "bbb1" ) ;
74
+ list2 . add ( "aaa1" ) ;
75
+ list2 . add ( "bbb3" ) ;
76
+ list2 . add ( "ccc" ) ;
77
+ list2 . add ( "bbb2" ) ;
78
+ list2 . add ( "ddd1" ) ;
79
+
80
+ list2
81
+ . stream ( )
82
+ . filter ( function ( el ) {
83
+ return el . startsWith ( "aaa" ) ;
84
+ } )
85
+ . sorted ( )
86
+ . forEach ( function ( el ) {
87
+ print ( el ) ;
88
+ } ) ;
You can’t perform that action at this time.
0 commit comments