• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get distinct names from a table

 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a table shich contain name of persons.I need to get the distinct names of the table.How can i do this?below is the example os table

Monday Tuesday Wednesday Thursday Friday
Tom Jhon Tom ULF Steve
William Nazee Jim Steve Sam
Sam ULF Steve ULF Tom
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create a Collection which does not allow duplicates. Iterate all the element in the table and add them to the Collection. The Collection would then have only unique names. See http://docs.oracle.com/javase/tutorial/collections/ and the API for the known subinterfaces of Collection (http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html) to pick which Collection might be best to use.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thaks Steve.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic