Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: blmblm@myrealbox.com Newsgroups: comp.lang.java.programmer Subject: Re: StringBuilder Difficulties Date: 6 Jul 2011 16:59:57 GMT Organization: None Lines: 28 Message-ID: <97jikdFr6pU3@mid.individual.net> References: <97hd9sFa1jU2@mid.individual.net> X-Trace: individual.net LBbBIeyq+cBicZOMOxWuwg9CX6vGB45Yhtkk+56yUT/Aek+sD6 X-Orig-Path: not-for-mail Cancel-Lock: sha1:E9jdrBg4Js1424ENV4ofLO7VXdM= X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5911 In article , supercalifragilisticexpialadiamaticonormalizeringelimatisticantations wrote: > On 05/07/2011 5:16 PM, blmblm@myrealbox.com wrote: > > In article, > > Gene Wirchenko wrote: > >> 1) I can output the set in order without having to do anything else. > >> My real program has a lot of debugging info dumping. (Read as "checks > >> that I have not done something wrong".) > > > > Ah. Well, yes, then you probably do need a SortedSet, though > > considering that you initially build the set from a string that's in > > order, maybe you could use that (the string) instead. > > Or a LinkedHashFoo of some stripe. Gene seems to be saying elsethread that in his real code he might be initializing from something that isn't in order. But assuming he could put it in order before initializing the set, then yes, it seems like a LinkedHashSet would do what he wants. I added it to my benchmark suite, reran timing experiments, and found LinkedHashSet to give performance very similar to that of HashSet. A day in which I learned something new -- not bad. Thanks! -- B. L. Massingill ObDisclaimer: I don't speak for my employers; they return the favor.