I’m having an issue looping through my generic collection. Although my class doesn’t show any compiling errors directly, the IDE (Netbeans) is showing an error on the the class icon within the project tree saying “Error parsing file”. Any help would be appreciated.
My code
public abstract class AutocompleteCacheImpl<E> implements AutocompleteCache {
public void store(Collection<E> es) {
for(E e : es) {
store(e);
}
}
public void store(E e) {
//do something
}
}
interface
public interface AutocompleteCache<E> {
public void store(Collection<E> es);
}
This is wrong, because the AutocompleteCache interface is also generic.
Try this:
Also, the keyword
publicshould come before the keywordabstract