我有下面的代码块
if(Objects.nonNull(isMine)) {
if (isMine) {
this.books= // gets it from the database;
} else {
this. books= // gets it from the database
}
} else {
this. books = // gets it from the database
}
Run Code Online (Sandbox Code Playgroud)
isMine - 是一个布尔对象,我尝试使用switch case,将isMine转换为字符串,如下所示
String.valueOf(isMine)
Run Code Online (Sandbox Code Playgroud)
但是没有用.建议在java中实现上述代码的更好,更快的方法.