In my program, I'm making use of an ArrayList of ArrayList of booleans. I need these values carried from class to class and I've been doing so by simply making it static
.
But I'm getting wind that this might be in bad taste. I was thinking that the best way to do without would be to make an object (a top-level one) with that collection as the central focus, probably with some methods to accompany this.
So my questions:
- Is this better?
- How do I keep one instance of the top-level object throughout the application so my values can transfer? I'm thinking a private constructor and static methods. Or should I just go with public fields? What is the approved method?