commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons/collections/src/java/org/apache/commons/collections ComparatorUtils.java
Date Wed, 15 Jan 2003 20:37:22 GMT
scolebourne    2003/01/15 12:37:22

  Modified:    collections/src/java/org/apache/commons/collections
                        ComparatorUtils.java
  Log:
  Add access method for new BooleanComparator
  
  Revision  Changes    Path
  1.6       +17 -0     jakarta-commons/collections/src/java/org/apache/commons/collections/ComparatorUtils.java
  
  Index: ComparatorUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/ComparatorUtils.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ComparatorUtils.java	17 Aug 2002 22:17:53 -0000	1.5
  +++ ComparatorUtils.java	15 Jan 2003 20:37:22 -0000	1.6
  @@ -56,6 +56,7 @@
   import java.util.Collection;
   import java.util.Comparator;
   
  +import org.apache.commons.collections.comparators.BooleanComparator;
   import org.apache.commons.collections.comparators.ComparableComparator;
   import org.apache.commons.collections.comparators.ComparatorChain;
   import org.apache.commons.collections.comparators.NullComparator;
  @@ -171,6 +172,22 @@
           return new ReverseComparator(comparator);
       }
   
  +    /**
  +     * Gets a Comparator that can sort Boolean objects.
  +     * <p>
  +     * The parameter specifies whether true or false is sorted first.
  +     * <p>
  +     * The comparator throws NullPointerException if a null value is compared.
  +     * 
  +     * @param trueFirst  when <code>true</code>, sort 
  +     *        <code>true</code> {@link Boolean}s before
  +     *        <code>false</code> {@link Boolean}s.
  +     * @return  a comparator that sorts booleans
  +     */
  +    public static Comparator booleanComparator(boolean trueFirst) {
  +        return BooleanComparator.getBooleanComparator(trueFirst);
  +    }
  +    
       /**
        * Gets a Comparator that controls the comparison of <code>null</code>
values.
        * <p>
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message