review 时和同事吵了一架 1 月中旬做 code review,我写了一段统计订单金额的代码: long total = orders.stream() .mapToLong(Order::getAmount) .sum(); 同事评论:"Stream 有性能
review 的时候,我看到一段"用 Optional 写的判空" 5 月底做代码评审,看到同事写了这么一段: Optional<User> userOpt = userMapper.findById(userId); if (userOpt.isPresent()) { User user
统计三月的订单,查出来是四月的 3 月中旬接了个老项目的改造任务,其中一块是给运营加个按月导出订单的功能。我写了个 SQL 拼时间的工具类,自测的时候点了三月,导出来的数据全是四月的。 当时那段代码: public static Date monthStart(int year, int month