for (ParameterMapping pm : boundSql.getParameterMappings()) {
String rmId = pm.getResultMapId();
if (rmId != null) {
ResultMap rm = configuration.getResultMap(rmId);
if (rm != null) {
hasNestedResultMaps |= rm.hasNestedResultMaps();
}
}
}
public static void main(String[] args) {
boolean flag = false;
for (int i = 0; i < 10; i++) {
flag |= i == 5;
}
System.out.println(flag);
}
上面输出为true。这个就是用来循环遍历时查找时的一次性赋值,避免覆盖的操作,写起来比较方便。
记录一波,免的忘记。
原文:https://www.cnblogs.com/zhou-yuan/p/14606532.html