Article View: borland.public.jbuilder.java.language
Article #465Re: Unique list
From: Lori M Olson [TeamB]
Date: Fri, 15 Apr 2005 13:28
Date: Fri, 15 Apr 2005 13:28
39 lines
1917 bytes
1917 bytes
Petar Popara wrote:
> I need a class (something like ArrayList), where I would add objects and
> it would not accept same object twice (it would only keep one reference of
> each object). Does something like this exists?
>
> Example:
>
> ArrayList a = new ArrayList();
> Integer i = new Integer(777);
> a.add(i);
> a.add(i); //ignore it
> a.add(i); //ignore it
> ...
>
>
Then you don't need a "list". You need a "set".
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Set.html
--
Regards,
Lori Olson [TeamB]
------------
Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.
Google Advanced Newsgroup Search
http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Technical Details
Message-ID:
<425fc17a@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<425fb3b7$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,a1404464e923cc6d X-Google-Attributes: gidf74b3,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Fri, 15 Apr 2005 07:28:20 -0600 From: "Lori M Olson [TeamB]" <javadragon@techie.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax;nscd1) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: Unique list References: <425fb3b7$1@newsgroups.borland.com> In-Reply-To: <425fb3b7$1@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 142.179.181.200 Message-ID: <425fc17a@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1113571706 142.179.181.200 (15 Apr 2005 06:28:26 -0800) Lines: 39 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail