Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 7th, 2005, 05:20 PM
souven souven is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 1 souven User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 23 sec
Reputation Power: 0
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!

Reply With Quote
  #2  
Old July 8th, 2005, 07:56 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
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.

Reply With Quote
  #3  
Old July 13th, 2005, 05:40 AM
proghelper proghelper is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 12 proghelper User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 46 m 21 sec
Reputation Power: 0
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:
Also, since these are non-changing but non-identical objects, what would be the best way to initialize them and set their values?


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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Class Project (Need Help!)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT