Skip to main content
gamedev.net
🔒 Locked

[java] Just Want Some Ideas

Started by ace84_84 1 reply 400+ views
Original Post
ace84_84
ace84_84
I have a project for school, that deals with 2d graphics. The user is allowed to create 'n' number of graphics (circle, rect, square). What would be the best way to keep all of these objects in, an array, a vector, hashtable???
Marianne
Marianne
if the number doesn't vary, an array. Otherwise, a vector, hashtable, collection, whatever just mess with'em and you'll see ;)
Optus
Optus
What Marianne said. Depending upon the performance desired any of these Collections would work. Shy away from Vector as it's synchronized(unless you need synchronization). Use ArrayList if you have a constant number of objects. Or, you can use a LinkedList, no maximum number of entries, no re-creating the collection to upsize, and pretty dang fast.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.