java8 stream 对 list 对象集合进行模糊匹配

  //对象集合
  List<OrderInfo> orderInfoList = new OrderInfo
  //根据名称进行模糊匹配 查询条件:searchName
  List<OrderInfo>  filterInfo= orderInfoList .stream().filter(orderInfo-> Boolean.FALSE?orderInfo.getName().equals(searchName):
                orderInfo.getName().contains(searchName))
                .sorted(Comparator.comparing(OrderInfo::getCreateTime).reversed)
                .collect(Collectors.toList());

你可能感兴趣的:(java,stream,jdk1.8)