0

How can i get the values of comp1 and comp2 .I have tried using iterator but it is giving me exception.

Update:If i have to get the values in another class than how can i do that

public class Complex {


 public List<String>comp1;
 public List<String>comp2;

public List<String> getComp2() {
    return comp2;
}

public void setComp2(List<String> comp2) {
    this.comp2 = comp2;
}

public List<String> getComp1() {
    return comp1;
}

public void setComp1(List<String> comp1) {
    this.comp1 = comp1;
}

}

Dani
  • 79
  • 9

1 Answers1

0
Iterator<String> it = comp1.getIterator();
while(it.hasNext()) {
   //do something with it
   it.next();
}

Same for comp2.

Robert
  • 255
  • 2
  • 15
  • 37