-2

I have a declaration as List<List<byte[]>>, i.e. inner list is list of byte arrays and there are N such lists. I want to identify common byte arrays across all the lists. How would I do that? There is a discussion here, but I donot know if it works for byte arrays

mobileDev
  • 1,358
  • 2
  • 14
  • 34

2 Answers2

0

You can use equals(byte[] a, byte[] a2), as suggested here.

Calaf
  • 1,133
  • 2
  • 9
  • 22
0

Use the solution you've linked, but as arrays don't have hashCode overriden, you have to wrap them in ByteBuffer, using ByteBuffer.wrap. To extract the array from a ByteBuffer, call array on it.

Andrew Vershinin
  • 1,958
  • 11
  • 16