2010-08-11 103 views
3

我在嘗試編譯時出現此錯誤:谷歌番石榴和錯誤我想不出

的方法filter(Iterable<T>, Predicate<? super T>)在類型Iterables不適用於參數(Iterator<PeopleSoftBalance>, ColumnLikePredicate<PeopleSoftBalance>

這裏是ColumnLikePredicate class sig:

public class ColumnLikePredicate<T extends RowModel> implements Predicate<T> 

我在做什麼錯?

+0

您可能想編輯問題,以便大家可以看到。請記住,這是一個網頁,大於和小於符號需要轉義。 – 2010-08-11 02:27:04

回答

14

聽起來像您正在將Iterator傳遞給期望Iterable的方法。

Iterator

迭代器在集合

Iterable

實現此接口允許一個對象是 「的foreach」 語句的目標。

Iterator是一個可用於迭代(不同)集合的對象。 Iterable是可以在上迭代的對象

我想你有某種collection,你打電話像Iterables.filter(collection.iterator(), predicate)。該Iterables類要你通過了Iterable本身,如:

Iterables.filter(collection, predicate) 
+0

大聲笑,我覺得我沒有讀它。 – arinte 2010-08-11 02:36:14

0

PeopleSoftBalance擴展RowModel嗎?