I need a class which can store and return values of differnt types. I couldn't define my own class. The only class I found that meets my needs is List class. I retrieve the values from database Table. This is my approach:
//the total number of these variables can vary. The same is true for their types;
int intValue = 1;
String stringValue = "text 1";
byte[] dataValue = new byte[4];
List row = new ArrayList();
row.add(intValue);
row.add(stringValue);
row.add(dataValue);
List rows = new ArrayList();
rows.add(row);
intValue = 6;
stringValue = "text 2";
dataValue = new byte[8];
row = new ArrayList();
row.add(intValue);
row.add(stringValue);
row.add(dataValue);
rows.add(row);
String text1 = (String) ((List)rows.get(0)).get(1);
String text2 = (String) ((List)rows.get(1)).get(1);
Can you suggest a better way to store generic type data because I think my implementation is wrong.