I'm using Iterator with its respective library, compile, but it throws this result:
COSTS @ 940a5a93 COSTS @ 940a5a93
This is my code:
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public final class ListaConcepto {
public static void main(String[] args) {
// TODO Auto-generated method stub
List<COSTOS> Lista = new ArrayList<COSTOS>();
COSTOS obj1 = new COSTOS(1781, 359.13, "BISAG.SUP.PUER.TRA.I", "67550T9AT00ZZ");
COSTOS obj2 = new COSTOS(1781, 359.13, "BISAG.SUP.PUER.TRA.I", "67550T9AT00ZZ");
Lista.add(obj1);
Lista.add(obj2);
System.out.println("¿Son iguales? " + obj1.equals(obj2));
Iterator iter = Lista.iterator();
while (iter.hasNext())
System.out.println(iter.next());
}
}
public class COSTOS {
private int referencia;
private double monto;
private String descripcion;
private String NumeroParte;
public COSTOS(int referencia, double monto, String descripcion, String numeroParte) {
this.referencia = referencia;
this.monto = monto;
this.descripcion = descripcion;
this.NumeroParte = numeroParte;
}
//getters and setters
This is my class code, what could you be doing or what is wrong or what I need to implement?