forked from Qortal/qortal
Small refactor for code simplicity.
This commit is contained in:
parent
9013d11d24
commit
0d0ccfd0ac
@ -55,9 +55,9 @@ public class ArbitraryDataFileRequestThread implements Runnable {
|
||||
// Sort by lowest number of node hops first
|
||||
Comparator<ArbitraryFileListResponseInfo> lowestHopsFirstComparator =
|
||||
Comparator.comparingInt(ArbitraryFileListResponseInfo::getRequestHops);
|
||||
arbitraryDataFileManager.arbitraryDataFileHashResponses = arbitraryDataFileManager.arbitraryDataFileHashResponses
|
||||
.stream().sorted(lowestHopsFirstComparator)
|
||||
.collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
|
||||
List<ArbitraryFileListResponseInfo> sortedResponses = arbitraryDataFileManager.arbitraryDataFileHashResponses
|
||||
.stream().sorted(lowestHopsFirstComparator).collect(Collectors.toList());
|
||||
arbitraryDataFileManager.arbitraryDataFileHashResponses = Collections.synchronizedList(sortedResponses);
|
||||
|
||||
Iterator iterator = arbitraryDataFileManager.arbitraryDataFileHashResponses.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
|
Loading…
Reference in New Issue
Block a user