MCPcopy Create free account
hub / github.com/davidgiven/luje / ReverseComparatorWithComparator

Class ReverseComparatorWithComparator

lib/java/util/Collections.java:209–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207 }
208
209 private static final class ReverseComparatorWithComparator<T> implements
210 Comparator<T>, Serializable {
211 private static final long serialVersionUID = 4374092139857L;
212
213 private final Comparator<T> comparator;
214
215 ReverseComparatorWithComparator(Comparator<T> comparator) {
216 super();
217 this.comparator = comparator;
218 }
219
220 public int compare(T o1, T o2) {
221 return comparator.compare(o2, o1);
222 }
223
224 @Override
225 public boolean equals(Object o) {
226 return o instanceof ReverseComparatorWithComparator
227 && ((ReverseComparatorWithComparator) o).comparator
228 .equals(comparator);
229 }
230
231 @Override
232 public int hashCode() {
233 return ~comparator.hashCode();
234 }
235 }
236
237 private static final class SingletonSet<E> extends AbstractSet<E> implements
238 Serializable {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected