Class IndexedCompare<T>

java.lang.Object
org.miaixz.bus.core.compare.IndexedCompare<T>
Type Parameters:
T - 被排序元素类型
All Implemented Interfaces:
Comparator<T>

public class IndexedCompare<T> extends Object implements Comparator<T>
按照数组的顺序正序排列,数组的元素位置决定了对象的排序先后 默认的,如果参与排序的元素并不在数组中,则排序在前(可以通过atEndIfMiss设置)
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • IndexedCompare

      public IndexedCompare(T... objs)
      构造
      Parameters:
      objs - 参与排序的数组,数组的元素位置决定了对象的排序先后
    • IndexedCompare

      public IndexedCompare(boolean atEndIfMiss, T... objs)
      构造
      Parameters:
      atEndIfMiss - 如果不在列表中是否排在后边
      objs - 参与排序的数组,数组的元素位置决定了对象的排序先后
  • Method Details