Results 1 to 2 of 2
Thread: Problems with collection
- 07-08-2007, 01:18 AM #1
Senior Member
- Join Date
- Jun 2007
- Posts
- 164
- Rep Power
- 14
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?
- 07-08-2007, 01:22 AM #2
Senior Member
- Join Date
- Jun 2007
- Posts
- 130
- Rep Power
- 0
you can wrap your Object and int in a value object:
check it:
Java 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; } }
Similar Threads
-
How to use Collection in Spring
By Java Tip in forum Java TipReplies: 0Last Post: 03-29-2008, 01:45 PM -
Garbase Collection
By Java Tip in forum Java TipReplies: 0Last Post: 11-30-2007, 10:37 AM -
How to use Collection in Springs
By JavaBean in forum Java TipReplies: 0Last Post: 09-26-2007, 09:36 PM
Bookmarks