Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
commons-collections4-4.2-sources.jar - Apache Commons Collections
commons-collections4-4.2-sources.jar is the source JAR file for Apache Commons Collections 4.2, which provides additional collection handling functionalities on top of JDK library.
JAR File Size and Download Location:
JAR name: commons-collections4-4.2-sources.jar Target JDK version: 1.7 Dependency: None File size: 708,599 bytes Release date: 08-Jul-2018 Download: Apache Commons Collections
✍: FYIcenter.com
⏎ org/apache/commons/collections4/comparators/ReverseComparator.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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.apache.commons.collections4.comparators; import java.io.Serializable; import java.util.Comparator; import org.apache.commons.collections4.ComparatorUtils; /** * Reverses the order of another comparator by reversing the arguments * to its {@link #compare(Object, Object) compare} method. * * @param <E> the type of objects compared by this comparator * * @since 2.0 * @see java.util.Collections#reverseOrder() */ public class ReverseComparator<E> implements Comparator<E>, Serializable { /** Serialization version from Collections 2.0. */ private static final long serialVersionUID = 2858887242028539265L; /** The comparator being decorated. */ private final Comparator<? super E> comparator; //----------------------------------------------------------------------- /** * Creates a comparator that compares objects based on the inverse of their * natural ordering. Using this Constructor will create a ReverseComparator * that is functionally identical to the Comparator returned by * java.util.Collections.<b>reverseOrder()</b>. * * @see java.util.Collections#reverseOrder() */ public ReverseComparator() { this(null); } /** * Creates a comparator that inverts the comparison * of the given comparator. If you pass in <code>null</code>, * the ReverseComparator defaults to reversing the * natural order, as per {@link java.util.Collections#reverseOrder()}. * * @param comparator Comparator to reverse */ @SuppressWarnings("unchecked") public ReverseComparator(final Comparator<? super E> comparator) { this.comparator = comparator == null ? ComparatorUtils.NATURAL_COMPARATOR : comparator; } //----------------------------------------------------------------------- /** * Compares two objects in reverse order. * * @param obj1 the first object to compare * @param obj2 the second object to compare * @return negative if obj1 is less, positive if greater, zero if equal */ @Override public int compare(final E obj1, final E obj2) { return comparator.compare(obj2, obj1); } //----------------------------------------------------------------------- /** * Implement a hash code for this comparator that is consistent with * {@link #equals(Object) equals}. * * @return a suitable hash code * @since 3.0 */ @Override public int hashCode() { return "ReverseComparator".hashCode() ^ comparator.hashCode(); } /** * Returns <code>true</code> iff <i>that</i> Object is * is a {@link Comparator} whose ordering is known to be * equivalent to mine. * <p> * This implementation returns <code>true</code> * iff <code><i>object</i>.{@link Object#getClass() getClass()}</code> * equals <code>this.getClass()</code>, and the underlying * comparators are equal. * Subclasses may want to override this behavior to remain consistent * with the {@link Comparator#equals(Object) equals} contract. * * @param object the object to compare to * @return true if equal * @since 3.0 */ @Override public boolean equals(final Object object) { if (this == object) { return true; } if (null == object) { return false; } if (object.getClass().equals(this.getClass())) { final ReverseComparator<?> thatrc = (ReverseComparator<?>) object; return comparator.equals(thatrc.comparator); } return false; } }
⏎ org/apache/commons/collections4/comparators/ReverseComparator.java
Or download all of them as a single archive file:
File name: commons-collections4-4.2-sources.jar File size: 708599 bytes Release date: 2018-07-08 Download
⇒ Download and Install commons-collections4-4.1-bin.zip
⇐ What Is commons-collections4-4.2.jar
2023-03-28, 27684👍, 0💬
Popular Posts:
JLayer is a library that decodes/plays/converts MPEG 1/2/2.5 Layer 1/2/3 (i.e. MP3) in real time for...
How to download and install mysql-connector-j-8.0.31 .zip?Connector/J Java library is a JDBC Driver ...
How to download and install xml-commons External Source Package? The source package contains Java so...
JDK 8 tools.jar is the JAR file for JDK 8 tools. It contains Java classes to support different JDK t...
JRE 8 rt.jar is the JAR file for JRE 8 RT (Runtime) libraries. JRE (Java Runtime) 8 is the runtime e...