集合
CollectionUtils.isNotEmpty(null);
数字
NumberUtils.isParsable(" ");
字符串
StringUtils.isNotBlank("");
String join = String.join("-", "2018", "08", "09");
System.out.println(join);
结果:
2018-08-09
List<String> list = Arrays.asList("java", "python", "nodejs", "ruby");
String result = String.join(", ", list);
System.out.println(result);
//out:
//java, python, nodejs, ruby
不同时间格式之间的转换
Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(inventoryTime);
String dateStr = new SimpleDateFormat("yyyyMMddHHmmss").format(date);
随机数
int size=10;//输出个数
int min=12;//最小值
int max=15;//最大值
new Random().ints(size, min, max+1).forEach(System.out::println);
MultiValuedMap
MultiValuedMap<String,String> map =new ArrayListValuedHashMap();
map.put("a","qq");
map.put("a","qq");
map.put("a","ss");
map.put("a","dd");
map.put("b","re");
map.put("b","fs");
Collection<String> a = map.get("a");
a.forEach(System.out::println);
//enrty
map.entries().forEach(System.out::println);
結果:
qq
qq
ss
dd
a=qq
a=qq
a=ss
a=dd
b=re
b=fs