for(k = i - 1; k >= 0; k--) {
if(frame[j] == page[k])
break;
least = least < k ? least : k;
}
我不明白这条线&#34; least = least < k ? least : k;
&#34;
任何人都可以为我解释
答案 0 :(得分:6)
相当于
least = Math.min(least, k);
或
if (!(least < k)) {
least = k
}
另请参阅:the Java documentation on the ternary operator(滚动到“条件运算符”部分)。
答案 1 :(得分:1)
least = least < k ? least : k;
相当于,
if(least < k)
least = least;
else
least = k;