有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (1) 个答案

  1. # 1 楼答案

    你可以这样说:

    hm.get(string).get(integer);
    

    如果你把它分开,它是这样的:

    ArrayList<Integer> arlist = hm.get(string); // This will return the string's hash map value
    int value = arlist.get(index); // This will return the ArrayList's index's element
    

    有关HashMap的get()的更多信息:https://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html#get(java.lang.Object)

    有关ArrayList的get()的更多信息:https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#get(int)