Use Math.min(...) and Math.max(...) as these are intrinsics.

Motivation:

We should better use Math utilities as these are intrinsics. This is a cleanup for ea3ffb8536.

Modifications:

Use Math utilities.

Result:

Cleaner code and use of intrinsics.
This commit is contained in:
Norman Maurer 2016-04-06 21:30:32 +02:00
parent 8bdf73edea
commit 560e0946b3

View File

@ -23,6 +23,8 @@ import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import static java.lang.Math.*;
final class PoolChunkList<T> implements PoolChunkListMetric { final class PoolChunkList<T> implements PoolChunkListMetric {
private static final Iterator<PoolChunkMetric> EMPTY_METRICS = Collections.<PoolChunkMetric>emptyList().iterator(); private static final Iterator<PoolChunkMetric> EMPTY_METRICS = Collections.<PoolChunkMetric>emptyList().iterator();
private final PoolChunkList<T> nextList; private final PoolChunkList<T> nextList;
@ -150,12 +152,12 @@ final class PoolChunkList<T> implements PoolChunkListMetric {
@Override @Override
public int minUsage() { public int minUsage() {
return minUsage == Integer.MIN_VALUE ? 1 : minUsage; return max(1, minUsage);
} }
@Override @Override
public int maxUsage() { public int maxUsage() {
return maxUsage == Integer.MAX_VALUE ? 100 : maxUsage; return min(maxUsage, 100);
} }
@Override @Override