虽然我还没有实现 Predicate 接口中的方法 - test - ,但为什么在我的类 - inte 中没有任何主体的情况下执行该方法?
package newone;
import java.util.function.Predicate;
public class inte {
public static void main(String[] args) {
Predicate <Integer> p = i -> (i<19);
System.out.println( p.test(22));
}
@FunctionalInterface
public interface Predicate<T> {
boolean test(T var1);
}
Run Code Online (Sandbox Code Playgroud) 我正在 Linux 机器上的 kubernetes 环境中创建 pod。我想等到所有 Pod 都处于运行状态。我已经在 bash 中编写了 while 循环,但即使 podstatus (变量)中没有“false”值,它仍然在循环。谢谢你的帮助!
verifyPods(){
timer=0
msg="false"
while [[ $timer -lt 15 && "false" == *"$msg"* ]] ;do
sleep 10
((timer=timer+1))
echo "Timer current value >> $timer and Pods statuses >> $podstatus"
podstatus=$(kubectl -n $ns get pods -o custom columns=metadata.name:status.containerStatuses[*].ready | grep true)
echo "Pod status is >> $podstatus and Timer is >> $timer"
done
}
Printed Output:
Pod status is >> true
true
true
true,true
true
true,true
true
true …Run Code Online (Sandbox Code Playgroud)