0

I was wondering if I can create an arraylist with info already in it...

Ex...
ArrayList playerinfo = [P0,[[1,2,3],[4,5,6]]]

If that makes sense.

The info I want in the arraylist will always be the same, as it will be what I am using to test my program.

However I need it to be in the same from as my randomly generated ArrayLists.

Thanks.

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Beasts
0

Well, you can but it's rather unwieldy

ArrayList playerinfo = new ArrayList(Arrays.asList(new Object[]{"blah","blah"}));

It would be much cleaner to just make a small static method to build and return the test data.

0

Thanks for that code it works just as needed, but i had not thought of a static method, that is a great idea. Thanks Again!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.