org.springframework.util.comparator

## 类 CompoundComparator<T>

- java.lang.Object
- - org.springframework.util.comparator.CompoundComparator<T>

- 所有已实现的接口:
    Serializable, Comparator<T>

  已过时。
  as of Spring Framework 5.0, in favor of the standard JDK 8 `Comparator.thenComparing(Comparator)`

      @Deprecated
      public class CompoundComparator<T>
      extends Object
      implements Comparator<T>, Serializable

  A comparator that chains a sequence of one or more Comparators.

  A compound comparator calls each Comparator in sequence until a single Comparator returns a non-zero result, or the comparators are exhausted and zero is returned.

  This facilitates in-memory sorting similar to multi-column sorting in SQL. The order of any single Comparator in the list can also be reversed.

  从以下版本开始:
    1.2.2
  作者:
    Keith Donald, Juergen Hoeller
  另请参阅:
    序列化表格

- - ### 构造器概要

    构造器
    构造器和说明
    `CompoundComparator()` 已过时。 Construct a CompoundComparator with initially no Comparators.
    `CompoundComparator(Comparator... comparators)` 已过时。 Construct a CompoundComparator from the Comparators in the provided array.

  - ### 方法概要

    所有方法 实例方法 具体方法 已过时的方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `addComparator(Comparator<? extends T> comparator)` 已过时。 Add a Comparator to the end of the chain.
    `void` | `addComparator(Comparator<? extends T> comparator, boolean ascending)` 已过时。 Add a Comparator to the end of the chain using the provided sort order.
    `int` | `compare(T o1, T o2)` 已过时。
    `boolean` | `equals(Object other)` 已过时。
    `int` | `getComparatorCount()` 已过时。 Returns the number of aggregated comparators.
    `int` | `hashCode()` 已过时。
    `void` | `invertOrder()` 已过时。 Invert the sort order of each sort definition contained by this compound comparator.
    `void` | `invertOrder(int index)` 已过时。 Invert the sort order of the sort definition at the specified index.
    `void` | `setAscendingOrder(int index)` 已过时。 Change the sort order at the given index to ascending.
    `void` | `setComparator(int index, Comparator<? extends T> comparator)` 已过时。 Replace the Comparator at the given index.
    `void` | `setComparator(int index, Comparator<T> comparator, boolean ascending)` 已过时。 Replace the Comparator at the given index using the given sort order.
    `void` | `setDescendingOrder(int index)` 已过时。 Change the sort order at the given index to descending sort.
    `String` | `toString()` 已过时。

    - ### 从类继承的方法 java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### 从接口继承的方法 java.util.Comparator

      `comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### 构造器详细资料

    - #### CompoundComparator

          public CompoundComparator()

      已过时。
      Construct a CompoundComparator with initially no Comparators. Clients must add at least one Comparator before calling the compare method or an IllegalStateException is thrown.

    - #### CompoundComparator

          public CompoundComparator(Comparator... comparators)

      已过时。
      Construct a CompoundComparator from the Comparators in the provided array.

      All Comparators will default to ascending sort order, unless they are InvertibleComparators.

      参数:
        `comparators` - the comparators to build into a compound comparator
      另请参阅:
        `InvertibleComparator`

  - ### 方法详细资料

    - #### addComparator

          public void addComparator(Comparator<? extends T> comparator)

      已过时。
      Add a Comparator to the end of the chain.

      The Comparator will default to ascending sort order, unless it is a InvertibleComparator.

      参数:
        `comparator` - the Comparator to add to the end of the chain
      另请参阅:
        `InvertibleComparator`

    - #### addComparator

          public void addComparator(Comparator<? extends T> comparator,
                                    boolean ascending)

      已过时。
      Add a Comparator to the end of the chain using the provided sort order.
      参数:
        `comparator` - the Comparator to add to the end of the chain
        `ascending` - the sort order: ascending (true) or descending (false)

    - #### setComparator

          public void setComparator(int index,
                                    Comparator<? extends T> comparator)

      已过时。
      Replace the Comparator at the given index.

      The Comparator will default to ascending sort order, unless it is a InvertibleComparator.

      参数:
        `index` - the index of the Comparator to replace
        `comparator` - the Comparator to place at the given index
      另请参阅:
        `InvertibleComparator`

    - #### setComparator

          public void setComparator(int index,
                                    Comparator<T> comparator,
                                    boolean ascending)

      已过时。
      Replace the Comparator at the given index using the given sort order.
      参数:
        `index` - the index of the Comparator to replace
        `comparator` - the Comparator to place at the given index
        `ascending` - the sort order: ascending (true) or descending (false)

    - #### invertOrder

          public void invertOrder()

      已过时。
      Invert the sort order of each sort definition contained by this compound comparator.

    - #### invertOrder

          public void invertOrder(int index)

      已过时。
      Invert the sort order of the sort definition at the specified index.
      参数:
        `index` - the index of the comparator to invert

    - #### setAscendingOrder

          public void setAscendingOrder(int index)

      已过时。
      Change the sort order at the given index to ascending.
      参数:
        `index` - the index of the comparator to change

    - #### setDescendingOrder

          public void setDescendingOrder(int index)

      已过时。
      Change the sort order at the given index to descending sort.
      参数:
        `index` - the index of the comparator to change

    - #### getComparatorCount

          public int getComparatorCount()

      已过时。
      Returns the number of aggregated comparators.

    - #### compare

          public int compare(T o1,
                             T o2)

      已过时。
      指定者:
        `compare` 在接口中 `Comparator<T>`

    - #### equals

          public boolean equals(Object other)

      已过时。
      指定者:
        `equals` 在接口中 `Comparator<T>`
      覆盖:
        `equals` 在类中 `Object`

    - #### hashCode

          public int hashCode()

      已过时。
      覆盖:
        `hashCode` 在类中 `Object`

    - #### toString

          public String toString()

      已过时。
      覆盖:
        `toString` 在类中 `Object`