// good
"string literal".equals(strObject)
// not good
strObject.equals("string literal")
javaBigDecimal bd = getPrice(); // good String.valueOf(bd); // not good bd.toString();
StringUtils.isEmpty(null); // returns true StringUtils.isBlank(null); // returns true StringUtils.isNumeric(null); // returns false StringUtils.isAllUpperCase(null); // returns false
Collections辅助类中有静态的EMPTY_LIST EMPTY_SET EMPTY_MAP,可以方便的使用它们
public List<Integer> f() {
try {
// ...
return result;
} catch (SomeException e) {
e.printStackTrace();
return Collections.EMPTY_LIST;
}
}
java@NonNull List<String> strList; // A non-null list of Strings. List<@NonNull String> strList; // A list of non-null Strings.
java// Integer getPrice(); int price = obj.getPrice();
javapublic class A {
private List<Integer> intList = new ArrayList<Integer>();
private String str = "";
}
JsonNode root = ...;
JsonNode child = root.get("lv1").get("lv2");
JsonNode root = ...;
JsonNode child = root.path("lv1").path("lv2");
if (child.isMissingNode()) { ... }
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有