ArrayList<Map.Entry<Integer, Float>> list = new ArrayList<Map.Entry<Integer, Float>>(datamap.entrySet());
Collections.sort(list,new floatSort());
list 是 Map.Entry 但仅包含 float 。现在我想将列表与 Float 中的其他 ArrayList 类型进行比较。如何从 Map.Entry 转换为 float
最佳答案
您可以使用Map.Entry.getValue.toString
,然后使用Integer.parseInt
将string
转换为int
String value = mapentry.getValue.toString;
int intValue = Integer.parseInt(value);
关于java - 如何在 Java 中从 Map.Entry<Integer,Float> 转换为 Integer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13885307/