Data acquisition method memo when there is HashMap in HashMap

As a personal note

Here's how to get a HashMap with nothing in particular

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));
         }
     }
}

How to get the value when HashMap matches in HashMap is as follows

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));
         }
     }
}

Recommended Posts

Data acquisition method memo when there is HashMap in HashMap
[For beginners] ○○. △△ in Ruby (ActiveRecord method, instance method, data acquisition)
When there is no output to stdout in docker log
[Ruby] Thinking when there is no receiver in front of the method (it looks like)
How to output the value when there is an array in the array
String output method memo in Ruby
Is there no type in Ruby?
Data is not registered in Rails.
Initial value when there is no form object property in Spring request
[Personal memo] Java data type is annoying
Command when dependency is broken in Ubuntu 20.04
What is the main method in Java?
Cause of is not visible when calling a method of another class in java
When there are environment variables in Java tests
Organized memo in the head (Java --Data type)
When the project is not displayed in eclipse