Double
四舍五入并保留小数点后两位
double score = 24.2455;
BigDecimal round = new BigDecimal(score).setScale(2, RoundingMode.UP);
System.out.println(round.doubleValue());
Iterable
转List类型
Iterable<Teacher> teacherIterable = repository.findAll();
List<Teacher> teacherList = new ArrayList<>();
teacherIterable.forEach(teacherList::add);
Collections
单个对象转换成List
List<MyObject> = Collections.singletonList(myObject);
将列表转换成不可修改的容器
Collections.unmodifiableList(items)