Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2002-2022 the original author or authors.
*
* 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
*
* https://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.springframework.core;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
* {@link Comparator} implementation for {@link Ordered} objects, sorting
* by order value ascending, respectively by priority descending.
*
*
{@code PriorityOrdered} Objects
*
{@link PriorityOrdered} objects will be sorted with higher priority than
* plain {@code Ordered} objects.
*
*
Same Order Objects
*
Objects that have the same order value will be sorted with arbitrary
* ordering with respect to other objects with the same order value.
*
*
Non-ordered Objects
*
Any object that does not provide its own order value is implicitly
* assigned a value of {@link Ordered#LOWEST_PRECEDENCE}, thus ending up
* at the end of a sorted collection in arbitrary order with respect to
* other objects with the same order value.
*
* @author Juergen Hoeller
* @author Sam Brannen
* @since 07.04.2003
* @see Ordered
* @see PriorityOrdered
* @see org.springframework.core.annotation.AnnotationAwareOrderComparator
* @see java.util.List#sort(java.util.Comparator)
* @see java.util.Arrays#sort(Object[], java.util.Comparator)
*/
public class OrderComparator implements Comparator