Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-12-2008, 09:39 PM
Member
 
Join Date: Jun 2008
Posts: 2
sopna sajith is on a distinguished road
Hastable - Multiple Types
can a single hashtable contain multiple datatype objects If so please give me an example
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-29-2008, 01:11 AM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Thread was moved and I'm sure willing folks will be able to assist momentarily.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-29-2008, 04:49 AM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: SW MO, USA
Posts: 1,556
Norm is on a distinguished road
Read the API doc for Hashtable, especially the put() method.
What is the datatype for the value?

ht.put("key", "value");
ht.put("key2", ht);
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 06-29-2008, 05:40 AM
fishtoprecords's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 349
fishtoprecords is on a distinguished road
@norm has the example. But doing so loses type safety, as you have to not use generics. Depending on your needs, this may be acceptable. Or you can define and use a polymorphic struct/class
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I use vectors to store multiple types of objects Nathand Advanced Java 6 04-28-2008 08:55 AM
Converting data types bluekswing New To Java 4 01-12-2008 01:48 AM
Types of JDBC drivers JavaForums Java Blogs 0 12-25-2007 02:21 PM
Displaying different image types splinter64uk AWT / Swing 1 12-05-2007 09:12 AM
Using enum types (with example) JavaForums Java Blogs 0 11-17-2007 03:43 AM


All times are GMT +3. The time now is 01:35 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org