Package org.apache.commons.collections.comparators

Examples of org.apache.commons.collections.comparators.NullComparator


public class TestataFatturaComparator implements Comparator<TestataFattura> {

  public int compare(TestataFattura tf1, TestataFattura tf2) {
   
    // ordino rispetto alla data fattura
    NullComparator nullComparator = new NullComparator(false);
    int retval = nullComparator.compare(tf1.getDataFattura(), tf2.getDataFattura());
    if (retval != 0) {
      return retval;
    }
   
    // poi rispetto al numero fattura
    NullComparator nullComparator2 = new NullComparator(false);
    retval = nullComparator2.compare(tf1.getNumeroFattura(), tf2.getNumeroFattura());
    if (retval != 0) {
      return retval;
    }
   
    return retval;
View Full Code Here


     */
    public static Comparator nullLowComparator(Comparator comparator) {
        if (comparator == null) {
            comparator = NATURAL_COMPARATOR;
        }
        return new NullComparator(comparator, false);
    }
View Full Code Here

     */
    public static Comparator nullHighComparator(Comparator comparator) {
        if (comparator == null) {
            comparator = NATURAL_COMPARATOR;
        }
        return new NullComparator(comparator, true);
    }
View Full Code Here

     * @return ordered list
     */
    @SuppressWarnings("unchecked")
    protected List sort(final List list) {
        Comparator comparator = new BeanComparator(this.sortColumn,
                new NullComparator(this.nullsAreHigh));
        if (!this.ascending) {
            comparator = new ReverseComparator(comparator);
        }
        Collections.sort(list, comparator);
        return list;
View Full Code Here

            offerMap.get(potential).add(candidate);
        }
        List<FulfillmentGroupOfferPotential> potentials = new ArrayList<FulfillmentGroupOfferPotential>();
        for (FulfillmentGroupOfferPotential potential : offerMap.keySet()) {
            List<PromotableCandidateFulfillmentGroupOffer> fgOffers = offerMap.get(potential);
            Collections.sort(fgOffers, new ReverseComparator(new BeanComparator("discountedAmount", new NullComparator())));
            Collections.sort(fgOffers, new BeanComparator("priority", new NullComparator()));

            if (potential.getOffer().isLimitedUsePerOrder() && fgOffers.size() > potential.getOffer().getMaxUsesPerOrder()) {
                for (int j = potential.getOffer().getMaxUsesPerOrder(); j < fgOffers.size(); j++) {
                    fgOffers.remove(j);
                }
View Full Code Here

     */
    public static Comparator nullLowComparator(Comparator comparator) {
        if (comparator == null) {
            comparator = NATURAL_COMPARATOR;
        }
        return new NullComparator(comparator, false);
    }
View Full Code Here

     */
    public static Comparator nullHighComparator(Comparator comparator) {
        if (comparator == null) {
            comparator = NATURAL_COMPARATOR;
        }
        return new NullComparator(comparator, true);
    }
View Full Code Here

     */
    public static Comparator nullLowComparator(Comparator comparator) {
        if (comparator == null) {
            comparator = NATURAL_COMPARATOR;
        }
        return new NullComparator(comparator, false);
    }
View Full Code Here

     */
    public static Comparator nullHighComparator(Comparator comparator) {
        if (comparator == null) {
            comparator = NATURAL_COMPARATOR;
        }
        return new NullComparator(comparator, true);
    }
View Full Code Here

/*     */   public static Comparator nullLowComparator(Comparator comparator)
/*     */   {
/* 161 */     if (comparator == null) {
/* 162 */       comparator = NATURAL_COMPARATOR;
/*     */     }
/* 164 */     return new NullComparator(comparator, false);
/*     */   }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.comparators.NullComparator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.