// Path: src/main/java/org/ardverk/lang/Precoditions.java
// public class Precoditions {
// 
//   private Precoditions() {}
//   
//   public static void argument(boolean expression) {
//     if (!expression) {
//       throw new IllegalArgumentException();
//     }
//   }
//   
//   public static void argument(boolean expression, String message) {
//     if (!expression) {
//       throw new IllegalArgumentException(message);
//     }
//   }
// 
//   public static void argument(boolean expression, 
//       String message, Object... arguments) {
//     if (!expression) {
//       throw new IllegalArgumentException(String.format(message, arguments));
//     }
//   }
// 
//   /**
//    * Makes sure the given argument is not {@code null}.
//    */
//   public static <T> T notNull(T t) {
//     return notNull(t, null);
//   }
//   
//   /**
//    * Makes sure the given argument is not {@code null}.
//    */
//   public static <T> T notNull(T t, String message) {
//     if (t == null) {
//       if (message != null) {
//         throw new NullPointerException(message);
//       }
//       throw new NullPointerException();
//     }
//     return t;
//   }
// }


import java.io.Serializable;
import java.util.Comparator;
import org.ardverk.lang.Precoditions;
/*
 * Copyright 2010-2012 Roger Kapsi
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

package org.ardverk.utils;



/**
 * A {@link ReverseComparator} takes a {@link Comparator} as input and reverses
 * the {@link Comparator}'s output. It's useful for changing the sorting order
 * for example.
 */
public class ReverseComparator<T> implements Comparator<T>, Serializable {
  
  private static final long serialVersionUID = 563094817278176159L;
  
  private final Comparator<? super T> comparator;
  
  public ReverseComparator(Comparator<? super T> comparator) {
// Path: src/main/java/org/ardverk/lang/Precoditions.java
// public class Precoditions {
// 
//   private Precoditions() {}
//   
//   public static void argument(boolean expression) {
//     if (!expression) {
//       throw new IllegalArgumentException();
//     }
//   }
//   
//   public static void argument(boolean expression, String message) {
//     if (!expression) {
//       throw new IllegalArgumentException(message);
//     }
//   }
// 
//   public static void argument(boolean expression, 
//       String message, Object... arguments) {
//     if (!expression) {
//       throw new IllegalArgumentException(String.format(message, arguments));
//     }
//   }
// 
//   /**
//    * Makes sure the given argument is not {@code null}.
//    */
//   public static <T> T notNull(T t) {
//     return notNull(t, null);
//   }
//   
//   /**
//    * Makes sure the given argument is not {@code null}.
//    */
//   public static <T> T notNull(T t, String message) {
//     if (t == null) {
//       if (message != null) {
//         throw new NullPointerException(message);
//       }
//       throw new NullPointerException();
//     }
//     return t;
//   }
// }


// Path: src/main/java/org/ardverk/utils/ReverseComparator.java
import java.io.Serializable;
import java.util.Comparator;
import org.ardverk.lang.Precoditions;

/*
 * Copyright 2010-2012 Roger Kapsi
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

package org.ardverk.utils;



/**
 * A {@link ReverseComparator} takes a {@link Comparator} as input and reverses
 * the {@link Comparator}'s output. It's useful for changing the sorting order
 * for example.
 */
public class ReverseComparator<T> implements Comparator<T>, Serializable {
  
  private static final long serialVersionUID = 563094817278176159L;
  
  private final Comparator<? super T> comparator;
  
  public ReverseComparator(Comparator<? super T> comparator) {
    this.comparator = Precoditions.notNull(comparator, "comparator");