Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/07/2010, 08:28
Avatar de mayid
mayid
Colaborador
 
Fecha de Ingreso: marzo-2009
Ubicación: BsAs
Mensajes: 4.014
Antigüedad: 15 años, 1 mes
Puntos: 101
obtener valor iterador java

Estoy implementando un iterador para recorrer un arrayList. Pero no se como hacer para que me devuelve un valor numerico que tengo almacenado en vez de un objeto:

Código:
import java.util.ArrayList;
import java.util.Iterator;

public class iterador 
 { 
 
public static void main(String args[]) {}
  


public iterador (){
  
  ArrayList<Integer> endPoints =  new ArrayList<Integer>();  
  int ePoints = 0;
  
if(!endPoints.contains(5)) // avpid duplicates
{
  endPoints.add(5); // capture the end points for new edges
  ePoints++;
};


// get the vertex for Edge.
     Iterator theEndPoints = endPoints.iterator();
     while (theEndPoints.hasNext())     
     { 
      if ( theEndPoints.next() != 3 )
       {
        System.out.println(theEndPoints.next());
       }
     }
}   
}
Lo que necesito evaluar es esto: if ( theEndPoints.next() != 3 )