Exemplo n.º 1
0
        /**
         * Gets a comparator that compares using an array of {@link Comparator}s, applied
         * in sequence until one returns not equal or the array is exhausted.
         *
         * @param comparators  the comparators to use, not null or empty or containing nulls
         * @return a {@link ComparatorChain} formed from the input comparators
         * @throws NullPointerException if comparators array is null or contains a null
         * @see ComparatorChain
         */
        public static java.util.Comparator <Object> chainedComparator(java.util.Comparator <Object>[] comparators)
        {
            ComparatorChain chain = new ComparatorChain();

            for (int i = 0; i < comparators.Length; i++)
            {
                if (comparators[i] == null)
                {
                    throw new java.lang.NullPointerException("Comparator cannot be null");
                }
                chain.addComparator(comparators[i]);
            }
            return(chain);
        }
 /**
  * Gets a comparator that compares using an array of {@link Comparator}s, applied
  * in sequence until one returns not equal or the array is exhausted.
  *
  * @param comparators  the comparators to use, not null or empty or containing nulls
  * @return a {@link ComparatorChain} formed from the input comparators
  * @throws NullPointerException if comparators array is null or contains a null
  * @see ComparatorChain
  */
 public static java.util.Comparator<Object> chainedComparator(java.util.Comparator<Object>[] comparators)
 {
     ComparatorChain chain = new ComparatorChain();
     for (int i = 0; i < comparators.Length; i++)
     {
         if (comparators[i] == null)
         {
             throw new java.lang.NullPointerException("Comparator cannot be null");
         }
         chain.addComparator(comparators[i]);
     }
     return chain;
 }