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.

Recommended Answers

All 2 Replies

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.

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.