|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Class Project (Need Help!)
I'm working on a application for a class that requires over 2000 static data objects to be continuously available. Someone mentioned using an array to store them all, but this seems like the brute force way of doing it. Can anyone think of another solution that would work better?
Also, since these are non-changing but non-identical objects, what would be the best way to initialize them and set their values? Thanks for all help! |
|
#2
|
||||
|
||||
|
Are they all in the same package?
If the classes are static, you should be able to refer to them easily by using Classname.method() You wouldn't need to instantiate the object. |
|
#3
|
|||
|
|||
|
You have to decide on the storage method based on the way you want to access the stored objects. Using an array is good, if you want to access them in a serial fashion.
However, if you want to access them in a random fashion, then you have so consider something like a Hashtable. Quote:
Well, the best is to use constructors with parameters. Then you need to implement only the "get" methods for the data mambers. You do not need "set" methods as you are not going to change the data members. --------- Programming (Assignment/Project) Help |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > Class Project (Need Help!) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|