TreeMap collection problem
in
Programming Questions
•
3 months ago
When I write these instructions in a Processing Class (also in the setup function)
-----------------------
TreeMap<Integer,String> tMap = new TreeMap<Integer,String>();
tMap.put(1,"A");
tMap.put(2,"B");
tMap.put(3,"C");
Set<Map.Entry<Integer,String>> set = tMap.entrySet();
-----------------------
the program says to me
/* Syntax error on token "<",TypeArgumentList2 expected after this token */
When I do the same thing in Eclipse
-----------------------
import java.util.*;
public class MapColl {
/**
* @param args
*/
public static void main(String[] args) {
TreeMap<Integer,String> tMap = new TreeMap<Integer,String>();
tMap.put(1,"A");
tMap.put(2,"B");
tMap.put(3,"C");
Set<Map.Entry<Integer,String>> set = tMap.entrySet();
for (Map.Entry<Integer,String> o : set){
System.out.print(o.getKey() + " : " );
System.out.println(o.getValue());
}
}
}
-----------------------
everything is ok. Why ??
Thanks for any help
-----------------------
TreeMap<Integer,String> tMap = new TreeMap<Integer,String>();
tMap.put(1,"A");
tMap.put(2,"B");
tMap.put(3,"C");
Set<Map.Entry<Integer,String>> set = tMap.entrySet();
-----------------------
the program says to me
/* Syntax error on token "<",TypeArgumentList2 expected after this token */
When I do the same thing in Eclipse
-----------------------
import java.util.*;
public class MapColl {
/**
* @param args
*/
public static void main(String[] args) {
TreeMap<Integer,String> tMap = new TreeMap<Integer,String>();
tMap.put(1,"A");
tMap.put(2,"B");
tMap.put(3,"C");
Set<Map.Entry<Integer,String>> set = tMap.entrySet();
for (Map.Entry<Integer,String> o : set){
System.out.print(o.getKey() + " : " );
System.out.println(o.getValue());
}
}
}
-----------------------
everything is ok. Why ??
Thanks for any help
1