com.github.bingoohuang.utils.lang.Arr Maven / Gradle / Ivy
The newest version!
package com.github.bingoohuang.utils.lang;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
public class Arr {
public static Optional find(T[] collection, V targetValue, Function getter) {
for (T item : collection) {
if (Objects.equals(targetValue, getter.apply(item))) {
return Optional.of(item);
}
}
return Optional.empty();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy