2011-10-31 2 views
0
나는 다음과 같은 코드에 대한 오류를 받고 있어요

:구아바의 Iterables.any()와 컴파일 타임 오류

Iterables.any(Lists.<String>newArrayList(), new Predicate<String>() { 
    @Override 
    public boolean apply(final String arg0) { 
    // TODO Auto-generated method stub 
    return false; 
    } 
}); 

오류 :

The method any(Iterable<T>, Predicate<? super T>) in the type Iterables is not applicable for the arguments (ArrayList<String>, new Predicate<String>(){})

내가 잘못 뭐하는 거지? 어리석은 실수를하는 것처럼 느껴집니다.

+3

수입은 어떻게됩니까? – Brigham

답변

6

죄송합니다. 잘못된 가져 오기를 사용하고 있습니다.

올바른

:

import com.google.common.base.Predicate; 
import com.google.common.collect.Iterables; 

잘못된 다음 repackaged 구아바를 사용

import com.google.appengine.repackaged.com.google.common.base.Predicate; 
import com.google.common.collect.Iterables; 

문제로 이어집니다.

+1

컴파일러 오류 메시지가 이와 같은 경우 전체 패키지 이름을 표시하면 좋을까요? – Thilo

관련 문제