import java.util.Comparator; public class VehiclePriceComparator implements Comparator<Vehicle>{ // sort by price public int compare<200b>(Vehicle o1, Vehicle o2){ return (int) (o1.getPrice() - o2.getPrice()); /* if( o1.getPrice() < o2.getPrice()){ return -1; }else if( o1.getPrice() > o2.getPrice()){ return 1; }else{ return 0; }*/ } }