views:

76

answers:

1

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.asList(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?

A: 

Use beanshell2, which supports varargs:

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

plinehan