Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #5727

Re: The behavior of "equals" method of Arrays.asList() implementation

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Eric Sosman <esosman@ieee-dot-org.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: The behavior of "equals" method of Arrays.asList() implementation
Date Tue, 28 Jun 2011 07:08:59 -0400
Organization A noiseless patient Spider
Lines 17
Message-ID <iuccqd$i9p$1@dont-email.me> (permalink)
References <b30a98ec-acc8-4e7b-bb9d-0de48a554d07@g2g2000vbl.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Tue, 28 Jun 2011 11:10:06 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="BrOwaJANne849xlH+KPYjQ"; logging-data="18745"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/McVzfch0ar1Ch2AU/H972"
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11
In-Reply-To <b30a98ec-acc8-4e7b-bb9d-0de48a554d07@g2g2000vbl.googlegroups.com>
Cancel-Lock sha1:eZxhxHcz9iusdGXqhKTemTmYVEw=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5727

Show key headers only | View raw


On 6/28/2011 5:19 AM, Alex J wrote:
> Basically I wonder if it is safe to use equals for collections (and
> junit's assertEquals in particular which in fact results in the
> *.equals invocation).
>
> One of collection instances I am working with is returned from
> Arrays.asList(..) method invocation.
> Sun JDK sources defines no equals method for
> java.util.Arrays.ArrayList inner class so I guess it is not safe to
> compare collections in that way.

     Look again.  The nested class extends AbstractList, and
inherits the equals() implementation from it.

-- 
Eric Sosman
esosman@ieee-dot-org.invalid

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

The behavior of "equals" method of Arrays.asList() implementation Alex J <vstrength@gmail.com> - 2011-06-28 02:19 -0700
  Re: The behavior of "equals" method of Arrays.asList() implementation Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-28 07:08 -0400
    Re: The behavior of "equals" method of Arrays.asList() implementation Lew <noone@lewscanon.com> - 2011-06-28 07:29 -0400
  Re: The behavior of "equals" method of Arrays.asList() implementation Roedy Green <see_website@mindprod.com.invalid> - 2011-06-28 10:04 -0700

csiph-web