LoginSignup
0
0

More than 5 years have passed since last update.

HashMap内にHashMapがある場合のデータ取得方法メモ

Posted at

個人的なメモとして

特に何もないHashMapの取得方法は以下だけど

HashMapSample1.java
import java.io.*;
import java.util.*

public class Sample {
    public static void main(String[] args){
         HashMap<Integer, String> hashMap = new HashMap <>();
         for(int key : hashMap.KeySet()) {
             System.out.println(hashMap.getkey));
         }
     }
}

HashMap内にHashMapが合った場合の値の取得方法は以下

HashMapSample2.java
import java.io.*;
import java.util.*

public class Sample {
    public static void main(String[] args){
         HashMap<Integer i, HashMap<String, String>> hashMap = new HashMap<>();
         for(int key : hashMap) {
             System.out.println(hashMap.get(key).get(target));
         }
     }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0