Results 1 to 3 of 3
  1. #1
    Dipke is offline Member
    Join Date
    Aug 2010
    Location
    Leuven, Belgium
    Posts
    86
    Rep Power
    0

    Default Find data in a hashset

    Hi,

    Ihave an hashset of objects.
    I want to search for a field in the object ex. object.name.

    Do i have to iterate the hashset or is there another way ?
    The whole object can be found with contains.
    But i want to search for one field only.

    kind regards

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    835
    Rep Power
    6

    Default

    Using getter methods u can retreive the contents.
    Refer the api for Hashset.
    HashSet (Java 2 Platform SE v1.4.2)

    Put your code also with comments and where you need assistance.
    Ramya:cool:

  3. #3
    Dipke is offline Member
    Join Date
    Aug 2010
    Location
    Leuven, Belgium
    Posts
    86
    Rep Power
    0

    Arrow

    Hi RamyaSivakanth,

    How do i do that.
    I do not find any get() into the hashSet, Set, Collection ....

    I have a hashSet<project>
    This "project" contains a Customer Class (and other).

    1) What do i have to do when i want to search for the name attribute in the Customer class ?

    2) How can i find an object when i have the HashCode ?

    kind regards

Similar Threads

  1. :( anyone here plz help on HashSet
    By waklo99 in forum New To Java
    Replies: 8
    Last Post: 09-20-2010, 03:02 AM
  2. Replies: 9
    Last Post: 08-25-2010, 07:31 AM
  3. HashSet Contains problem
    By guywalder in forum Advanced Java
    Replies: 11
    Last Post: 09-01-2009, 02:48 PM
  4. HashSet anomaly
    By jon80 in forum New To Java
    Replies: 1
    Last Post: 06-21-2009, 08:22 PM
  5. Iterating through a HashSet
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-21-2008, 04:34 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •