D
D
DmitryPros2017-08-19 18:41:44
Java
DmitryPros, 2017-08-19 18:41:44

Why are two byte[] arrays not compared?

There is a method:

private static boolean contains (byte[] findObj, List<byte[]> inToObj) {
        for (byte[] line:
                inToObj) {
            if (findObj.equals(line))
                return true;
        }
        return false;
    }

2 identical byte arrays are served, but equals returns false.
2cff1661685d4c949596a04cbe6042f6.PNG
How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2017-08-19
@DmitryPros

Well actually here:
https://stackoverflow.com/questions/8777257/equals...
You are comparing links, not content.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question