BigDaddyLoveHandle

Ok, I'm sorry to bother u. Just wondering pls, how come

System.out.println(Arrays.equals(aa, bb)); prints false? I mean from the code snippet u used as example for the deepEquals and equals.

The API says:

>if the two specified arrays of ints are equal to one another: I think so

>if both arrays contain the same number of elements: think so too

>all corresponding pairs of elements in the two arrays are equal: think so

>In other words, two arrays are equal if they contain the same elements in the same order

Here is the code again

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);

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

}

}

Thanx

[925 byte] By [petitea] at [2007-11-27 11:51:42]
# 1

looks like petite wants you specifically :) try not and crush him hahaha

mark07a at 2007-7-29 18:39:51 > top of Java-index,Java Essentials,Java Programming...
# 2

Can someone else field this? I'm about to experience afternoon delight with a calzone, and I may be away for some time...

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

Try running this code instead and examine the differences:

int [] a = {1, 2};

int [] b = {1, 2};

int [][]aa = {a};

int [][] bb = {a};

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

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

hunter9000a at 2007-7-29 18:39:51 > top of Java-index,Java Essentials,Java Programming...
# 4

Ok, I'm not like that guys. Not just the type. Just decided to address the message to him b'cos he posted the code. so pls can any one else help pls.

Thanks in advance

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

O that sounds like fun... it's becuase aa and bb really are aa= [a, null] bb= [b, null] and deepEquals say's there equal becuase If both array references are null they are also considered deeply equal but the equal command says they aren't

mark07a at 2007-7-29 18:39:51 > top of Java-index,Java Essentials,Java Programming...
# 6

> Ok, I'm not like that guys. Not just the type. Just

> decided to address the message to him b'cos he posted

> the code. so pls can any one else help pls.

>

> Thanks in advance

I'm just messing with you no worries I'm stuck at work and it sucks gota have fun somehow ^.^ and i might have explained that wrong can't really tell any feedback?

mark07a at 2007-7-29 18:39:51 > top of Java-index,Java Essentials,Java Programming...
# 7

Well, thanks guys. I get it now.

Thanx again

petitea at 2007-7-29 18:39:51 > top of Java-index,Java Essentials,Java Programming...
# 8

Without additional checking, i suspect that this statement in the deepEquals method states why the results are different:

Unlike the equals(Object[],Object[]) method, this method is appropriate for use with nested arrays of arbitrary depth.

While there is no correspondingly opposite statement in the the equals method, it appears (from the above) that there could be a mention of the linitation.

ChuckBinga at 2007-7-29 18:39:51 > top of Java-index,Java Essentials,Java Programming...
# 9

Good work, everyone. I ended up having a calzone, a panzerotti and a stromboli.

BigDaddyLoveHandlesa at 2007-7-29 18:39:52 > top of Java-index,Java Essentials,Java Programming...
# 10

Sounds awfully volcanic to me.

DrClapa at 2007-7-29 18:39:52 > top of Java-index,Java Essentials,Java Programming...
# 11

> Sounds awfully volcanic to me.

It's partly the leather chair.

BigDaddyLoveHandlesa at 2007-7-29 18:39:52 > top of Java-index,Java Essentials,Java Programming...
# 12

> > Sounds awfully volcanic to me.

>

> It's partly the leather chair.

You ate a leather chair as well?

floundera at 2007-7-29 18:39:52 > top of Java-index,Java Essentials,Java Programming...
# 13

> > > Sounds awfully volcanic to me.

> >

> > It's partly the leather chair.

>

> You ate a leather chair as well?

Probably needed the extra fiber after a meal like that.

drawimagea at 2007-7-29 18:39:52 > top of Java-index,Java Essentials,Java Programming...
# 14

It seems to be open season on BDLH.

BigDaddyLoveHandlesa at 2007-7-29 18:39:52 > top of Java-index,Java Essentials,Java Programming...
# 15

yea we all wish we could execute command alt-kill BDLH.setVisible(false)

TuringPesta at 2007-7-29 18:39:56 > top of Java-index,Java Essentials,Java Programming...
# 16

Well, ever since I earned that miserable tin star I've been wanted to make myself

scarce. But that's no easy task for a guy who make grown Chinese Buffet

restauranteurs cry.

BigDaddyLoveHandlesa at 2007-7-29 18:39:56 > top of Java-index,Java Essentials,Java Programming...
# 17

im sorry buddy. ive just been on edge ever since djaunl called

my moms fat. i only cyberbully... because... im just so... insecure...

TuringPesta at 2007-7-29 18:39:56 > top of Java-index,Java Essentials,Java Programming...
# 18

Does someone need a hug?

floundera at 2007-7-29 18:39:56 > top of Java-index,Java Essentials,Java Programming...
# 19

i have skittles that serve just that purpose.

TuringPesta at 2007-7-29 18:39:56 > top of Java-index,Java Essentials,Java Programming...