Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

1.10.1

Compare
Choose a tag to compare
@venusdrogon venusdrogon released this 09 Mar 04:47
· 311 commits to master since this release

本次升级共有4处变更,具体参见 1.10.1 milestone

1.10.1 文档地址: http://feilong-core.mydoc.io/

1.特性 🆕

  • ✨ 添加 MapUtil.get(Map<K, V>, int) fix #595

  • ✨ 添加 List<O> collect(Iterable<I> inputBeanIterable,Class<O> outputListBeanType,String...includePropertyNames) method fix #559

    假设你有两个类, User,Customer

    此时你需要将 List<User> 转换成 List<Customer>

     List<User> list = toList(
                     new User(23L, "张飞"),
                     new User(24L, "关羽"),
                     new User(25L, "刘备"));

    以前你需要如此这般写:

      List<Customer> customerList = new ArrayList<>();
      for (User user : list){
          Customer customer = new Customer();
          customer.setId(user.getId());
          customer.setName(user.getName());
          customerList.add(customer);
      }

    如果属性很多,书写代码很繁琐

    现在你可以这么写:

       List<Customer> customerList = CollectionsUtil.collect(list, Customer.class);

    一行代码搞定集合转换问题

    如果你只想转换id属性,你可以:

       List<Customer> customerList = CollectionsUtil.collect(list, Customer.class,"id");
  • ✨ 添加 IgnoreCaseEquator fix #597

  • ✨ 添加 BeanPredicateUtil.equalIgnoreCasePredicate(String,String) fix #598

    在list中查找 name是 zhangfei(忽视大小写) 的user

      List<User> list = toList(
     			 new User("zhangfei", 22),
     			 new User("zhangFei", 22),
     			 new User("Zhangfei", 22),
     			 new User((String) null, 22),
     			 new User("guanyu", 25),
     			 new User("liubei", 30)
      );
    
      List<User> select = select(list, BeanPredicateUtil.<User> equalIgnoreCasePredicate("name", "zhangfei"));

2.修改

  • none

3.移除

  • none

4.Bug 修复 🐛

  • 🐛 change CollectionsUtil.collect method, 如果入参是null,那么返回null fix #601