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
精彩评论