[GUAVA] Predicate 사용예

		<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
		<dependency>
		    <groupId>com.google.guava</groupId>
		    <artifactId>guava</artifactId>
		    <version>24.0-jre</version>
		</dependency>
		List<OnlineMenuVO> selectMenu2List = this.uiMainService.selectMenu2List(this.custCoCd);
		Predicate<OnlineMenuVO> lvl1ListPredicate = new Predicate<OnlineMenuVO>() {
			@Override
			public boolean apply(@Nullable OnlineMenuVO onlineMenuVO) {
				if(onlineMenuVO.getClsLvl() == 1){
					return true;
				}
				return false;
			}
		};
		List<OnlineMenuVO> lvl1List = Lists.newArrayList(Iterables.filter(selectMenu2List, lvl1ListPredicate));

 

You may also like...

답글 남기기

이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다.