From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7bcba1db9ed24fa7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-08 03:07:11 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.media.kyoto-u.ac.jp!sjc-peer.news.verio.net!news.verio.net!iad-read.news.verio.net.POSTED!kilgallen From: Kilgallen@eisner.decus.org.nospam (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: is ada dead? Message-ID: References: <3B460DA9.C2965042@ix.netcom.com> <9ff447f2.0107061757.34ca0723@posting.google.com> <9i6lak$bqi$1@geraldo.cc.utexas.edu> <3B475916.E4548A5D@worldnet.att.net> Organization: LJK Software Date: 8 Jul 2001 06:07:04 -0500 NNTP-Posting-Host: 216.44.122.34 X-Complaints-To: abuse@verio.net X-Trace: iad-read.news.verio.net 994586826 216.44.122.34 (Sun, 08 Jul 2001 10:07:06 GMT) NNTP-Posting-Date: Sun, 08 Jul 2001 10:07:06 GMT Xref: archiver1.google.com comp.lang.ada:9632 Date: 2001-07-08T06:07:04-05:00 List-Id: In article , stephen_bevan@yahoo.com (Stephen J. Bevan) writes: > James Rogers writes: >> In other words, if >> you want to loop through all the characters in an existing 1024 >> character String, replacing each one, you will require the creation >> and garbage collection of 1024 1024 character strings. Since Java >> characters are all 16 bits, this means that you need to chew up >> over 2 Megabytes of data to edit a 1024 character String. > > You could do it like that. However, it would be more efficient to > turn your String into a StringBuffer, which supports in-place updates. > Make all the changes you want to the StringBuffer and then turn it > back into a String. This way you'd only chew up approximately 3K. Programmers should not have to know the efficiency characteristics of mechanisms underlying an implementation to that level of detail.