My Pair class:
public class Pair<o,t> {
      private o one;
      private t two;
      public Pair(o one, t two) {
        this.one = one;
        this.two = two;
      }
      public o getO() { 
          return one;
      }
      public void setO(o one) {
          this.one = one;
      }
      public t getT() {
          return two;
      }
      public void setT(t two) {
          this.two= two;
      }
}
In my main application I fill a list with the pair object:
List<Pair<Integer, String>> test = new ArrayList<Pair<Integer, String>>();
Pair<Integer, String> pair;
pair.setO(1);
pair.setT("A");
test.add(pair);
pair.setO(2);
pair.setT("B");
test.add(pair);
I want to be able to get the integer value only by list index, eg. for-loop to write out A, B, etc. How would I do that? Is there a simpler way of doing such a thing in Java?
 
     
     
     
    