com.vladsch.flexmark.util.collection.MaxAggregator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of flexmark-util-collection Show documentation
Show all versions of flexmark-util-collection Show documentation
flexmark-java collection utility classes
The newest version!
package com.vladsch.flexmark.util.collection;
import java.util.function.BinaryOperator;
import org.jetbrains.annotations.Nullable;
public class MaxAggregator implements BinaryOperator {
public static final MaxAggregator INSTANCE = new MaxAggregator();
private MaxAggregator() {}
@Override
public @Nullable Integer apply(@Nullable Integer aggregate, @Nullable Integer next) {
return next == null || aggregate != null && aggregate >= next ? aggregate : next;
}
}