File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed
modules/main/src/main/java/com/annimon/ownlang/modules/functional Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -9,18 +9,11 @@ public final class functional_stream implements Function {
9
9
public Value execute (Value [] args ) {
10
10
Arguments .checkAtLeast (1 , args .length );
11
11
12
- if (args .length > 1 ) {
13
- return new StreamValue (new ArrayValue (args ));
14
- }
15
-
16
12
final Value value = args [0 ];
17
- switch (value .type ()) {
18
- case Types .MAP :
19
- return new StreamValue (((MapValue ) value ).toPairs ());
20
- case Types .ARRAY :
21
- return new StreamValue ((ArrayValue ) value );
22
- default :
23
- throw new TypeException ("Invalid argument. Array or map expected" );
24
- }
13
+ return switch (value .type ()) {
14
+ case Types .MAP -> new StreamValue (((MapValue ) value ).toPairs ());
15
+ case Types .ARRAY -> new StreamValue ((ArrayValue ) value );
16
+ default -> throw new TypeException ("Invalid argument. Array or map expected" );
17
+ };
25
18
}
26
19
}
You can’t perform that action at this time.
0 commit comments