开发者

Anonymous arrays in BeanShell

Is there a syntax for declaring anonymous arrays in BeanShell? I would like to write code analogous to the following:

print(Arrays.asList("cat", "dog"))

but BeanShell fails to find the "asList" method, presumably because it doesn't understand varargs.

As a workaround, I could write:

print(Arrays.a开发者_运维问答sList(new Object[]{"cat", "dog"}))

but that seems excessively verbose.

Is there a compact BeanShell syntax for anonymous arrays, e.g.:

print(Arrays.asList(["cat", "dog"]))

Is there a better way to go about solving this problem altogether?


Use beanshell2, which supports varargs:

http://code.google.com/p/beanshell2/issues/detail?id=13

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜