Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin3!goblin.stu.neva.ru!newsfeed3.funet.fi!newsfeed2.funet.fi!newsfeeds.funet.fi!fi.sn.net!newsfeed1.tdcnet.fi!news.song.fi!not-for-mail Date: Tue, 21 Jun 2011 09:55:23 +0300 From: Donkey Hottie User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; fi; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10 ThunderBrowse/3.3.5 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Something Better than ArrayList References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <7rr5d8-iug.ln1@hurricane.fredriksson.dy.fi> Lines: 37 Organization: NBL Networks Oy NNTP-Posting-Host: 213.157.94.92 X-Trace: 1308639331 news.nbl.fi 2852 213.157.94.92:36540 X-Complaints-To: abuse@nblnetworks.fi Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5457 21.6.2011 8:34, Gene Wirchenko kirjoitti: > Dear Java'ers: > > I have been using ArrayList to serve as an expandable array. I > have not cared about the searching efficency since the arrays have > been small. > > Now, I need symbol table processing. There will be a lot of > lookups. What class is like ArrayList in being an expandable array > but that has an order? I also want to have more than one data item > per entry. I am looking at > symbol name (which is what the array is to be sorted by) > symbol value > and possibly something else by the time I think on this further. > Symbol name and symbol value will be of type String though I would > like a general answer. > > The name of the class is what I need. I assume I can find the > docs once I know what it is called. > > Sincerely, > > Gene Wirchenko I think you need a Map That is the interface, the implementation could be HashMap or TreeMap HashMap does not keep ordering, but TreeMap does. Both offer the lookup with symbol name though, and that is what you need, I think. -- An exotic journey in downtown Newark is in your future.