Returns an ordering based on an existing comparator instance. Note that it is unnecessary to create a new anonymous inner class implementing Comparator just to pass it in here. Instead, simply subclass Ordering and implement its compare method directly. @param
(Comparator<T> comparator)
| 162 | */ |
| 163 | |
| 164 | @GwtCompatible(serializable = true) |
| 165 | public static <T> Ordering<T> from(Comparator<T> comparator) { |
| 166 | return (comparator instanceof Ordering) |
| 167 | ? (Ordering<T>) comparator |
| 168 | : new ComparatorOrdering<T>(comparator); |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Simply returns its argument. |
no test coverage detected