小编use*_*964的帖子

Java Predicate Interface - 该方法如何工作 - 尽管它没有在我的类中实现

虽然我还没有实现 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)

java interface predicate

1
推荐指数
1
解决办法
629
查看次数

Bash + Kubectl - 等待所有 pod 都处于运行状态

我正在 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)

bash kubectl

1
推荐指数
1
解决办法
2091
查看次数

标签 统计

bash ×1

interface ×1

java ×1

kubectl ×1

predicate ×1