Skip to content

Commit 4247348

Browse files
committed
nfs: use Comparator.comparing unstead of guava's Ordering
Use java standard API as recommended by guava Acked-by: Lea Morschel Target: master
1 parent 91708e3 commit 4247348

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

core/src/main/java/org/dcache/nfs/ExportFile.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009 - 2020 Deutsches Elektronen-Synchroton,
2+
* Copyright (c) 2009 - 2022 Deutsches Elektronen-Synchroton,
33
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
44
*
55
* This library is free software; you can redistribute it and/or modify
@@ -24,7 +24,7 @@
2424
import com.google.common.collect.ImmutableListMultimap;
2525
import com.google.common.collect.ImmutableMultimap;
2626
import com.google.common.collect.Multimap;
27-
import com.google.common.collect.Ordering;
27+
import java.util.Comparator;
2828
import org.slf4j.Logger;
2929
import org.slf4j.LoggerFactory;
3030

@@ -135,11 +135,11 @@ private static ImmutableMultimap<Integer, FsExport> parse(URI... exportFiles) th
135135
}
136136

137137
/*
138-
* sort in reverse order to get smallest network first
138+
* sort in reverse order to get the smallest network first
139139
*/
140140
return exportsBuilder
141-
.orderValuesBy(Ordering.from(HostEntryComparator::compare).onResultOf(FsExport::client))
142-
.build();
141+
.orderValuesBy(Comparator.comparing(FsExport::client, HostEntryComparator::compare))
142+
.build();
143143
}
144144

145145
private static ImmutableMultimap<Integer, FsExport> parseExportLines(Iterable<String> lines) throws IOException {
@@ -304,11 +304,11 @@ private static ImmutableMultimap<Integer, FsExport> parseExportLines(Iterable<St
304304
}
305305

306306
/*
307-
* sort in reverse order to get smallest network first
307+
* sort in reverse order to get the smallest network first
308308
*/
309309
return exportsBuilder
310-
.orderValuesBy(Ordering.from(HostEntryComparator::compare).onResultOf(FsExport::client))
311-
.build();
310+
.orderValuesBy(Comparator.comparing(FsExport::client, HostEntryComparator::compare))
311+
.build();
312312
}
313313

314314
@Override
@@ -331,7 +331,7 @@ public FsExport getExport(int index, InetAddress client) {
331331
public Stream<FsExport> exports(InetAddress client) {
332332
return _exports.values().stream()
333333
.filter(e -> e.isAllowed(client))
334-
.sorted(Ordering.from(HostEntryComparator::compare).onResultOf(FsExport::client));
334+
.sorted(Comparator.comparing(FsExport::client,HostEntryComparator::compare));
335335
}
336336

337337
public final void rescan() throws IOException {

0 commit comments

Comments
 (0)