Article View: borland.public.jbuilder.java.language
Article #710Re: Collections.sort(List)
From: Gillmer J. Derge [TeamB]
Date: Thu, 02 Dec 2004 21:31
Date: Thu, 02 Dec 2004 21:31
22 lines
1996 bytes
1996 bytes
Alan Shiers wrote: > Do you see anything else I should be aware of? No. I guessed that it was related to Comparable, because the signature for sort is: public static <T extends Comparable<? super T>> void sort(List<T> list) You obviously have a List<T>, so the issue had to be the constraints on T, but I wasn't able to duplicate the error in my tests. I tried not implementing Comparable at all and implementing Comparable<Card> but I didn't try implementing a non-genericized Comparable. > Is the signature for the compareTo() method correct? Yes. For Comparable<T>, the signature is int compareTo(T object). JBuilder will tell you if it's wrong, though in my experiments I discovered that ErrorInsight doesn't automatically create the correct signature if you tell it to implement the abstract methods. -- Gillmer J. Derge [TeamB]
Technical Details
Message-ID:
<41af89b2$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!transit.news.xs4all.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41af522d@newsgroups.borland.com> <41af5ea1$1@newsgroups.borland.com> <41af7630$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,2868f4df97a5ed32 X-Google-Attributes: gidf74b3,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Thu, 02 Dec 2004 16:31:33 -0500 From: "Gillmer J. Derge [TeamB]" <spam@gillmerderge.com> User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: Collections.sort(List) References: <41af522d@newsgroups.borland.com> <41af5ea1$1@newsgroups.borland.com> <41af7630$1@newsgroups.borland.com> In-Reply-To: <41af7630$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.149.56.230 Message-ID: <41af89b2$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1102023090 24.149.56.230 (2 Dec 2004 13:31:30 -0700) Lines: 22 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!transit.news.xs4all.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail