make TimedCounter#decrement(K) easier to read

This commit is contained in:
EbonJaguar 2017-03-06 14:15:07 -05:00
parent 7d4bfcd99d
commit fa65b1af5e

View File

@ -45,8 +45,12 @@ public class TimedCounter<K> extends ExpiringMap<K, Integer> {
ExpiringEntry<Integer> e = entries.get(key);
if (e != null) {
if (e.getValue() <= 0) { remove(key); }
else {entries.put(key, new ExpiringEntry<>(e.getValue() - 1, e.getExpiration())); }
if (e.getValue() <= 0) {
remove(key);
}
else {
entries.put(key, new ExpiringEntry<>(e.getValue() - 1, e.getExpiration()));
}
}
}