Collecting Groups of [3 Objects]

J

Jeff S

What are some reasonable options for storing collections of [3 related
object variables]. I see that there are plenty of options for storing
collections of individual items (e.g., string or int array) or for
name/value pairs (e.g., hash table). But I have a need to create some sort
of a collection that lets me collect groups of 3 object variables, like
this:

object_1a object_1b object_1c
object_2a object_2b object_2c
object_3a object_3b object_3c
object_4a object_4b object_4c
etc...

Each of these will be for instances of the MVP pattern - so for example
object_1a would be a Model instance, object_1b would be the associated
Presenter and object_1c would be the associated View object (custom Form).

Code then encapsulates this collection would need to be able to search this
collection for a specific Model instance and then be able to return its
associated Presenter or View.

Thanks for your time and consideration.

-Jeff
 
D

DKode

If it were me, I would probably create a struct with an Array in it to
store object_1a, object_1b etc...

then add the structs to another arraylist, so then when you access one
struct, you get the object refs from the arraylist within the struct
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top