Article View: borland.public.jbuilder.java.api
Article #1103Re: < or >
From: HardCase
Date: Fri, 21 Jun 2002 11:15
Date: Fri, 21 Jun 2002 11:15
32 lines
1952 bytes
1952 bytes
Reiz wrote:
> if (string1.compareTo(string2) == -1) // string1 < string2
> {
> .... code .....
> }
>
> if (string1.compareTo(string2) == 1) // string1 > string2
> {
> .... code .....
> }
>
> if (string1.compareTo(string2) == 0) // string1 == string2
> {
> .... code .....
> }
you better write:
if ( ){
...
} else if ( ){
...
}
Most of the time it doesn't make your program very faster, but when you
want (for example) to compare two files (their content), this is much
better.
--
PENTIUM = Produces Erroneous Numbers Thru Incorrect Understanding of
Math
* MSN dhertsen_2@hotmail.com ICQ 157482585
* http://www.sphosting.com/dietmar
Technical Details
Message-ID:
<3D130AB1.558547DC@tiscali.be>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.belnet.be!news.belnet.be!ossa.telenet-ops.be!afrodite.telenet-ops.be.POSTED!not-for-mailReferences:
<aetafp$9tjac$1@ID-97157.news.dfncis.de> <3d122f57.20062197@news.online.no> <87660d912w.fsf@nbook.wohnheim.uni-kl.de> <aetcb6$9rcg1$1@ID-97157.news.dfncis.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,59a0cb87210dc727 X-Google-Attributes: gid1089d0,public X-Google-Thread: 113ae9,59a0cb87210dc727 X-Google-Attributes: gid113ae9,public X-Google-ArrivalTime: 2002-06-21 04:15:12 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.belnet.be!news.belnet.be!ossa.telenet-ops.be!afrodite.telenet-ops.be.POSTED!not-for-mail Message-ID: <3D130AB1.558547DC@tiscali.be> From: HardCase <dhertsen@tiscali.be> X-Mailer: Mozilla 4.72 [en] (Win98; I) X-Accept-Language: nl MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.api,comp.lang.java.help Subject: Re: < or > References: <aetafp$9tjac$1@ID-97157.news.dfncis.de> <3d122f57.20062197@news.online.no> <87660d912w.fsf@nbook.wohnheim.uni-kl.de> <aetcb6$9rcg1$1@ID-97157.news.dfncis.de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 32 Date: Fri, 21 Jun 2002 11:15:08 GMT NNTP-Posting-Host: 213.224.209.137 X-Complaints-To: abuse@telenet.be X-Trace: afrodite.telenet-ops.be 1024658108 213.224.209.137 (Fri, 21 Jun 2002 13:15:08 MET DST) NNTP-Posting-Date: Fri, 21 Jun 2002 13:15:08 MET DST Organization: Telenet Internet