Тип CollectionStore <T>должен реализовывать унаследованный абстрактный метод Iterable <T>.iterator (). - PullRequest
1 голос
/ 20 июня 2019

У меня проблема с Eclipse.я установил jdk1.8.я импортировал исходный код BouncyCastle в свое затмение и получил ошибки вроде:

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();
}
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...