初学者QQ:我有一个列表和一个Map。我需要对照“列表”检查“地图”中的所有值,如果该值在地图中但不在列表中,那么我需要将其删除
List<String> list = getRequiredList();
Set<String> set = new HashSet<>(list)
Map<String, String> map = getMap();
Run Code Online (Sandbox Code Playgroud)
需要一些有关如何从地图中删除(如果不在列表中)的信息
I want to add a null check to my ternary operator which checks on a Boolean isValue:
public String getValue() {
return isValue ? "T" : "F";
}
Run Code Online (Sandbox Code Playgroud)
My task is:
What if the Boolean(object) return null? Add a boolean check and return "" (empty String in case if its null).
Note that isValue is a Boolean, not boolean.