Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / June 2005

Tip: Looking for answers? Try searching our database.

remove redundency in list of pairs

Thread view: 
bluedoze@yahoo.com - 27 Jun 2005 14:28 GMT
Hello,

I want to construct a list of pairs without dupliactes, not the key
value pairs, I just want to ensure that the pair (not ordered) is not
dupliacted in the list.

for example

method input: (3, 4), (5, 6), (4, 3), (6, 5)

method output: (3, 4), (5, 6).

I can do this manually, but is there any utility in the java language
itself ?

Bluedoze
Leon - 27 Jun 2005 15:22 GMT
Hi,

> I want to construct a list of pairs without dupliactes, not the key
> value pairs, I just want to ensure that the pair (not ordered) is not
[quoted text clipped - 5 lines]
>
> method output: (3, 4), (5, 6).

Define your own pair-class, including an equals-method (and hash-method). Then
declare a (Hash)Set.

Greetings, Leon.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.