List<ChildPools> childPoolsList = parentIdPool.getChildPools();
// Sorting the child pools on last accessed time so that the pool that
// was not accessed for a long time comes first.
- Collections.sort(childPoolsList, comparing(ChildPools::getLastAccessTime));
+ childPoolsList.sort(comparing(ChildPools::getLastAccessTime));
long currentTime = System.currentTimeMillis() / 1000;
for (ChildPools childPools : childPoolsList) {
if (childPools.getLastAccessTime() + DEFAULT_IDLE_TIME > currentTime) {
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
BoundServices lower = null;
List<BoundServices> availableServiceInfos = new ArrayList<>(serviceInfos);
- Collections.sort(availableServiceInfos, (serviceInfo1, serviceInfo2) -> serviceInfo1.getServicePriority()
- .compareTo(serviceInfo2.getServicePriority()));
+ availableServiceInfos.sort(Comparator.comparing(BoundServices::getServicePriority));
for (BoundServices availableServiceInfo : availableServiceInfos) {
if (currentServiceInfo.getServicePriority() < availableServiceInfo.getServicePriority()) {
lower = availableServiceInfo;
import com.google.common.util.concurrent.Futures;
import java.math.BigInteger;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import org.junit.ComparisonFailure;
import org.mockito.Mockito;
private List<FlowEntity> sortFlows(Iterable<FlowEntity> flowsToSort) {
List<FlowEntity> sortedFlows = Lists.newArrayList(flowsToSort);
- Collections.sort(sortedFlows,
- (flow1, flow2) -> ComparisonChain.start()
- .compare(flow1.getTableId(), flow2.getTableId())
+ sortedFlows.sort((flow1, flow2) -> ComparisonChain.start()
+ .compare(flow1.getTableId(), flow2.getTableId())
.compare(flow1.getPriority(), flow2.getPriority())
- .compare(flow1.getFlowId(), flow2.getFlowId())
+ .compare(flow1.getFlowId(), flow2.getFlowId())
.result());
return sortedFlows;
}