Search:

Type: Posts; User: tcstcs

Search: Search took 0.11 seconds.

  1. Thread: Question on Set

    by tcstcs
    Replies
    9
    Views
    2,321

    Re: Question on Set

    I wrote this program but its giving o/p as false,false only without duplicates.
    public static void main(String[] args)
    {
    HashSet hh = new HashSet();
    String aa = new String("a");
    String bb...
  2. Thread: Question on Set

    by tcstcs
    Replies
    9
    Views
    2,321

    Re: Question on Set

    with the program, we will not be able to see the results. Reason being
    If set has {a,s,d,f}
    I will add 's' to set and after addition it will be {a,s,d,f}
    So we will not know whether its prev 's'...
  3. Thread: Question on Set

    by tcstcs
    Replies
    9
    Views
    2,321

    Re: Question on Set

    HashSet is implemented with HashMap. So in HashMap, if i add element with existing key the older value gets replaced with new one. Then in set as its based on HashMap, older value should be replaced...
  4. Thread: Question on Set

    by tcstcs
    Replies
    9
    Views
    2,321

    Question on Set

    In a set if we have 5 objects {'a','v','d','w','r'}
    And if i add one more same element say 'd', will the earlier 'd' object be retained in Set or it will be replaced by new 'd' object.
Results 1 to 4 of 4