Você está aqui: Página Inicial Disciplinas Estrutura de Dados Lineares - 2016.2 Comparador.java

Comparador.java

Comparador.java — Java source code, 774 bytes

Conteúdo do arquivo

/*
 * Created on 09/03/2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */

/**
 * @author robinson
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class Comparador {	
	public int comparar(Object a, Object b){
	    Integer a1=null,b1=null;
	    if(a!=null)
	      a1=new Integer(a.toString());	    
	    if(b!=null)
	      b1=new Integer(b.toString());
	    
	    if((a==null)&&(b!=null))
	        return (new Integer(0)).compareTo(b1);
	    else if((b==null)&&(a!=null))
	        return a1.compareTo((new Integer(0)));
	    else
	        return a1.compareTo(b1);	}
}
« Maio 2024 »
Maio
DoSeTeQuQuSeSa
1234
567891011
12131415161718
19202122232425
262728293031