1 25 26 package org.objectweb.jonas.webapp.jonasadmin.service.container; 27 28 import java.util.Comparator ; 29 30 33 public class ContainerItemByFile implements Comparator { 34 35 37 public int compare(Object pO1, Object pO2) { 38 ContainerItem oContainer1 = (ContainerItem) pO1; 39 ContainerItem oContainer2 = (ContainerItem) pO2; 40 if ((oContainer1.getFile() == null) || (oContainer2.getFile() == null)) { 41 if ((oContainer1.getFile() == null) && (oContainer2.getFile() == null)) { 42 return 0; 43 } else if ((oContainer1.getFile() == null) && (oContainer2.getFile() != null)) { 44 return 1; 45 } else { 46 return -1; 47 } 48 } 49 return oContainer1.getFile().compareToIgnoreCase(oContainer2.getFile()); 50 } 51 52 public boolean equals(Object pObj) { 53 if (pObj instanceof ContainerItem) { 54 return true; 55 } 56 return false; 57 } 58 } | Popular Tags |