2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Mapのkeyを配列にするとうまいこといかない

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

のようなint配列をキー、要素にした配列を利用したのだが、

map.get(int配列)

で、引数に指定したint配列に合致するkeyに紐づく要素が取り出せない。

対処法としては、

にあるように、keyを配列でもつのではなく、Arrays.toStringなりをしてStringでkeyを持つようにする。

2
1
3

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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?