Normal
Fast gleich:[CODE=java]final String ID_SEPARATOR = "_";Set<String> _channelIdList = new HashSet<>();private void sortChannelIds() { _channelIdList = _channelIdList.parallelStream() .sorted(Comparator.comparingLong(this::getMilliseconds)) .collect(Collectors.toCollection(LinkedHashSet::new));}private long getMilliseconds(String value) { return Long.valueOf(value.split(ID_SEPARATOR)[5]);}[/CODE]Es sortiert auf jeden Fall richtig.
Fast gleich:
[CODE=java]final String ID_SEPARATOR = "_";
Set<String> _channelIdList = new HashSet<>();
private void sortChannelIds() {
_channelIdList = _channelIdList.parallelStream()
.sorted(Comparator.comparingLong(this::getMilliseconds))
.collect(Collectors.toCollection(LinkedHashSet::new));
}
private long getMilliseconds(String value) {
return Long.valueOf(value.split(ID_SEPARATOR)[5]);
}[/CODE]
Es sortiert auf jeden Fall richtig.