treeset 是默认有序的,对于无序的hashset除了实现排序接口和遍历之外,可以先转化为list集合,用Collections的内置方法sort完成排序
Set<String> cardiIds = erasableDataUtil.getKeys(pattern);
List<String> cardiIdsList = new ArrayList<>(cardiIds);
Collections.sort(cardiIdsList);
treeset 是默认有序的,对于无序的hashset除了实现排序接口和遍历之外,可以先转化为list集合,用Collections的内置方法sort完成排序
Set<String> cardiIds = erasableDataUtil.getKeys(pattern);
List<String> cardiIdsList = new ArrayList<>(cardiIds);
Collections.sort(cardiIdsList);