我有以下方法
private <T> void verify(String message, Supplier<T> targetSupplier,
Predicate<T> predicate) {
String verification = "verify that " + message;
System.out.println(" -> " + verification);
long start = System.currentTimeMillis();
while ((System.currentTimeMillis() - start) < timeoutInMs) {
try {
T target = targetSupplier.get();
if (predicate.test(target)) {
return Verification.ok();
}
result = Verification.ko();
} catch (NotFoundException e) {
result = Verification.notFound();
}
}
}
Run Code Online (Sandbox Code Playgroud)
和a
List<String> ABC
Run Code Online (Sandbox Code Playgroud)
如何使用Java 8 lambda表达式检查ABC是否按升序/降序排列?
多谢