Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
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 07-08-2007, 02:18 AM
Senior Member
 
Join Date: Jun 2007
Posts: 164
Heather is on a distinguished road
Problems with collection
I need to create a "table" of values. The columns are

Object, int, int

this table will have no more than 100 rows at any time
I have reviewed collections such as HashMap, but it seems you can only have two 'columns' and the primitives would have to be converted to Integer Objects

Is there a collection I can use that allows me to define three columns with different data types?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-08-2007, 02:22 AM
Senior Member
 
Join Date: Jun 2007
Posts: 130
Jack is on a distinguished road
you can wrap your Object and int in a value object:
check it:
Code:
public class ValueObject { private Object obj; private int first; private int second; public ValueObject(Object obj, int first, int second) { this.obj = obj; this.first = first; this.second = second; } public Object getObject() { return object; } public int getFirst() { return first; } public int getSecond() { return second; } }
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
How to use Collection in Spring Java Tip Java Tips 0 03-29-2008 02:45 PM
Using LinkedList (Collection) JavaForums Java Blogs 0 12-05-2007 08:00 PM
Garbase Collection Java Tip Java Tips 0 11-30-2007 11:37 AM
How to use Collection in Springs JavaBean Java Tips 0 09-26-2007 10:36 PM
Garbage Collection JavaForums Java Blogs 0 08-04-2007 04:24 AM


All times are GMT +3. The time now is 10:45 AM.


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