public static void main(String[] args) {
        String[] regulation = {"诸葛亮","鲁班","貂蝉","吕布"};
        final List<String> regulationOrder = Arrays.asList(regulation);
        String[] ordered = {"貂蝉","诸葛亮","吕布","貂蝉","鲁班","诸葛亮","貂蝉","鲁班","诸葛亮"};
        List<String> orderedList = Arrays.asList(ordered);
        Collections.sort(orderedList, new Comparator<String>()
        {
            @Override
            public int compare(String o1, String o2)
            {
                int io1 = regulationOrder.indexOf(o1);
                int io2 = regulationOrder.indexOf(o2);
                return io1 - io2;
            }
        });
        System.out.println(orderedList);
    }

  

相关文章:

  • 2021-04-03
  • 2022-01-17
  • 2021-12-24
  • 2022-12-23
  • 2021-04-17
  • 2022-12-23
  • 2021-06-08
  • 2021-08-12
猜你喜欢
  • 2022-12-23
  • 2021-07-15
  • 2022-12-23
  • 2021-08-18
  • 2022-12-23
  • 2021-04-05
  • 2021-11-24
相关资源
相似解决方案