如何根据数字和字母对Bean数组列表进行排序

时间:2019-08-14 12:13:40

标签: java

我需要基于包含数字,数字字母,字母的字符串对bean arraylist进行排序。 例如,{10,11,12 ,11A,SA,AD,FF}应该显示为10,11,11A,12,AD,FF,SA。我尝试了下面的代码

ComparatorChain comparatorChain = new ComparatorChain();
Comparator comparator = new BeanComparator("tagId", new NullComparator(
                true));
comparatorChain.addComparator(comparator);
Collections.sort(nonGroupLineROList, comparatorChain);

的结果

{10,11,2,12 ,11A,SA,AD,FF}

{10,11,11A,12,2,AD,FF,SA}

预期结果是

 {2.10,11,11A,12,AD,FF,SA}

0 个答案:

没有答案