I use StringMap class as below to simplify Map declaration:
public interface StringMap extends Map<String, String> {
interface Entry extends java.util.Map.Entry<String, String>{
}
}
public class StringHashMap extends HashMap<String, String> implements StringMap{
}
The problem is that I can't make StringMap.Entry work the same way as StringMap. If I do this:
StringMap strings = new StringHashMap(); // this works perfectly fine
for (StringMap.Entry entry : strings.entrySet()) { // this doesn't work
}
I get this error:
Error:(402, 49) java: incompatible types: java.util.Map.Entry<java.lang.String,java.lang.String> cannot be converted to com.nicksoft.nslib.StringMap.Entry
Is there a way around it?
Edit:
I'm starting to realize this is not possible. At least it's not possible with reasonable efforts. I guess if it was I would have found someone else doing it. But if someone has some tricks that can make code more readable - let me know.