gpt4 book ai didi

java - 在 onBindviewHolder 中使用没有循环的标签

转载 作者:可可西里 更新时间:2023-11-01 11:42:32 25 4
gpt4 key购买 nike

我正在尝试使用这段代码:

@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
label :{
if(some condition) {
//my code
} else {
if(my condition) {
//some code
continue label; // from here i want to go back to label, how to i go?
}
}
}
}

行继续标签;给我这个错误:不是循环标签

所以我需要回到“标签”行我该怎么做?

最佳答案

为什么必须使用“标签”循环?

尝试使用 while 循环,如下所示:

@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
while (true) {
if (some condition) {
// my code
break; // if this code ran then exit the while loop
} else if (my condition) {
// some code
continue; // from here it will make another iteration in the while loop
}
}
}

关于java - 在 onBindviewHolder 中使用没有循环的标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35698996/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com