类型CollectionStore <T>必须实现继承的抽象方法Iterable <T> .iterator()

时间:2019-06-19 23:05:13

标签: java

我对Eclipse有问题。我设置了jdk1.8。 我将BouncyCastle源代码导入到了eclipse中,并出现了以下错误:

The type CollectionStore<T> must implement the inherited abstract method Iterable<T>.iterator()

The type Collection is not generic; it cannot be parameterized with arguments <T>

The type Collection is not generic; it cannot be parameterized with arguments <T>

....... 我该如何解决?

package org.bouncycastle.util;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

public class CollectionStore<T>
implements Store<T>, Iterable<T>
 {
private Collection<T> _local;


public CollectionStore(
    Collection<T> collection)
{
    _local = new ArrayList<T>(collection);
}


public Collection<T> getMatches(Selector<T> selector)
{
    if (selector == null)
    {
        return new ArrayList<T>(_local);
    }
    else
    {
        List<T> col = new ArrayList<T>();
        Iterator<T> iter = _local.iterator();

        while (iter.hasNext())
        {
            T obj = iter.next();

            if (selector.match(obj))
            {
                col.add(obj);
            }
        }

        return col;
    }
}

public Iterator<T> iterator()
{
    return getMatches(null).iterator();
}
}

0 个答案:

没有答案