java: how do I create an array of tuples


how can I create an array of tuples in jsp (java) like (a:1, b:2) (c:3, d:4) ... ...


Answers:


Create a tuple class, something like:

class Tuple {
    private Object[] data;
    public Tuple (Object.. members) { this.data = members; }
    public void get(int index) { return data[index]; }
    public int getSize() { ... }
}

Then just create an array of Tuple instances.