Screening out the list of qualified data (return list)

    /**
	 * 根据条件筛选list
	 * @param list 需要筛选的list
	 * @param tableColumnName 对象的属性名
	 * @param agers 需要筛选的条件
	 * @return Collection
	 */
	public Collection checkList(List list, String tableColumnName, String agers){
        List templist = new ArrayList();
        EqualPredicate parameter = new EqualPredicate(agers);
        BeanPredicate tableCoulmnParamerter = new BeanPredicate(tableColumnName, parameter);
        Predicate[] allPredicateArray = {tableCoulmnParamerter };
        Predicate allPredicate = PredicateUtils.allPredicate(allPredicateArray);
        Collection filteredCollection = CollectionUtils.select(list, allPredicate);
        return filteredCollection;
    }

transfer :

Incoming collection need to filter the list as needed & conditions of the property name (eg: "orderNo") & conditions need to be screened 

Collection segkList = checkList(segList, "orderNo", ticketOrderInfo.getOrderNo());
List<TicketOrderSegmentInfo> cartItems = new ArrayList<TicketOrderSegmentInfo>(segkList);

 

Released four original articles · won praise 3 · Views 1505

Guess you like

Origin blog.csdn.net/a502628025/article/details/104253619