[JAVA] It doesn't work if the Map key is an array

Map<int[], int[]> map = new HashMap<int[] ,int[]>();

I used an array with an int array as a key and an element like

map.get(int array)

So, the element associated with the key that matches the int array specified in the argument cannot be retrieved.

As a workaround,


As shown in, instead of using an array as a key, make Arrays.toString and have a key as a String.

Recommended Posts

It doesn't work if the Map key is an array
Get the type of an array element to determine if it is an array
If the parameter is an array, how to include it in Stopara's params.permit
Is it faster if the docker bind mount is readonly?
Is there an instance even if the constructor fails?
Check if you're using Databinding and it doesn't work
The program doesn't work, the program doesn't stop ...
Library to check if it is an IPv4 format string
Is it an Android app?
If it doesn't change with the disable_with option in Safari
[Quarkus] A trap that doesn't work even if you copy and paste the GCP Pub / Sub sample as it is
What to do if validation doesn't work with the update action
How to output the value when there is an array in the array
Isn't it reflected even if the content is updated in Rails?
"RSpec doesn't work!" The cause was spring, so I investigated it.
An active hash that can be treated as data even if it is not in the database
Puma --Nignx is an escape route when rails s -e production -d doesn't work in the environment
Memo: [Java] If a file is in the monitored directory, process it.
If the JDK version is correct in Eclipse but an error occurs or the compiler does not work properly
Map without using an array in java
Compare the elements of an array (Java)
If it is Ruby, it is efficient to make it a method and stock the processing.