I am working on a simple reader of configuration files for fun, but I get an odd error when writing a test method. It has a loop in it for, and I made sure that this is causing the problem. This gives me this compilation error:
Incompatible types:
Required: java.util.Map.Entry
Found: java.lang.Object
The card declaration is as follows:
Map<String, String> props = new HashMap<String, String>();
The cycle is forwritten as follows:
for (Map.Entry<String, String> entry : props.entrySet()) {
}
SSCCE without import, which demonstrates the problem (at least in IntelliJ):
public class A {
public static void main(String[] args) {
Map<String, String> props = new HashMap<String, String>();
for (int i = 0; i < 100; i++) {
props.put(new BigInteger(130, random).toString(32), new BigInteger(130, random).toString(32));
}
for (Map.Entry<String, String> entry : props.entrySet()) {
System.out.println(entry.getKey() + ":" + entry.getValue());
}
}
}
map Map<String, String>, . googled , , , , ! - . . , , - .