I’m getting this compiler error in netbeans:
incompatible types
required: String
found: java.lang.String
I’m kind of lost as why this happens?
Code:
private class StringIterator<String> implements Iterator<String> {
private Iterator<Entry<K, byte[]>> i = internalMap.entrySet().iterator();
@Override
public boolean hasNext() {
return i.hasNext();
}
@Override
public String next() {
return decompress(i.next().getValue());// error on this line
}
@Override
public void remove() {
i.remove();
}
}
You should remove the type argument from the StringIterator class. This is causing the compiler to consider any occurrence of String in the class to be a generic type rather than java.lang.String.