Using a byte array as Map key
It’s okay so long as you only want reference equality for your key – arrays don’t implement “value equality” in the way that you’d probably want. For example: byte[] array1 = new byte[1]; byte[] array2 = new byte[1]; System.out.println(array1.equals(array2)); System.out.println(array1.hashCode()); System.out.println(array2.hashCode()); prints something like: false 1671711 11394033 (The actual numbers are irrelevant; the fact that …