convert ArrayList.toString() back to ArrayList in one call
Posted
by dotnetnewbie
on Stack Overflow
See other posts from Stack Overflow
or by dotnetnewbie
Published on 2010-05-05T14:33:56Z
Indexed on
2010/05/05
14:38 UTC
Read the original article
Hit count: 430
I have a toString()
representation of an ArrayList
.
Copying the toString()
value to clipboard, I want to copy it back into my IDE editor, and create the ArrayList
instance in one line. In fact, what I'm really doing is this:
- my ArrayList.toString() has data I need to setup a unit test.
- I want to copy this ArrayList.toString() into my editor to build a test against this edge case
- I don't want to parse anything by hand
My input looks like this:
[15.82, 15.870000000000001, 15.92, 16.32, 16.32, 16.32, 16.32, 17.05, 17.05, 17.05, 17.05, 18.29, 18.29, 19.16]
The following do not work:
Arrays.asList()
- google collections
Lists.newArrayList()
Suggestions?
© Stack Overflow or respective owner