deepEquals and equals

Hello,

pls can anyone tell me the difference between Arrays' deepEquals and equals method? Checked Java API, couldn't see any difference.

Thanks.

[166 byte] By [petitea] at [2007-11-27 11:51:33]
# 1

That's strange. When I looked, the entry for deepEquals() was much longer than the entry for equals().

DrClapa at 2007-7-29 18:38:50 > top of Java-index,Java Essentials,Java Programming...
# 2

So you're saying the difference in the methods is that one has a longer API entry?

;-)

import java.util.*;

public class DeepEqualsExample {

public static void main(String[] args) {

int[] a = {1, 2};

int[] b = {1, 2};

int[][] aa = {a};

int[][] bb = {b};

System.out.println("Arrays.equals(aa,bb)=" + Arrays.equals(aa,bb));

System.out.println("Arrays.deepEquals(aa,bb)=" + Arrays.deepEquals(aa,bb));

}

}

BigDaddyLoveHandlesa at 2007-7-29 18:38:50 > top of Java-index,Java Essentials,Java Programming...
# 3

always helps to read everything

http://java.sun.com/j2se/1.5.0/docs/api/java/util/Arrays.html#deepEquals(java.lang.Object[],%20java.lang.Object[])

mark07a at 2007-7-29 18:38:50 > top of Java-index,Java Essentials,Java Programming...
# 4

Well, thanks everyone especially, bigDaddyLoveHandles. Ur suggestions are very helpful. I understand now.

Thanx

petitea at 2007-7-29 18:38:50 > top of Java-index,Java Essentials,Java Programming...
# 5

> Ur suggestions are very helpful.

I didn't see where he mentioned Mesopotamia at all.

~

yawmarka at 2007-7-29 18:38:50 > top of Java-index,Java Essentials,Java Programming...
# 6

I made me a mess o' potamia for lunch. Them's good eatin'!

BigDaddyLoveHandlesa at 2007-7-29 18:38:50 > top of Java-index,Java Essentials,Java Programming...
# 7

> So you're saying the difference in the methods is

> that one has a longer API entry?

No, I'm making the trivial observation that if the entries have different lengths then they cannot be the same. And hence anybody who thought they were the same should look again.

DrClapa at 2007-7-29 18:38:50 > top of Java-index,Java Essentials,Java Programming...