Skip to Content
avatar image
Former Member

Removing duplicate entries in a dropdownlist

Hi Experts,

How to remove duplicate entries from dropdownlist in web dynpro java? Can someone please help me

I have maintained the data in the z table wherein the records of particular fields are repeated but when i show that record in the Web Dynpro application dropdown list, the user should only be able to view the unique data for selection of that particular field.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jan 02, 2015 at 06:42 AM

    Hi Preetam,

    I think, you can use your java skills for this. You can follow any of the way as mentioned below

    1. Keep all the String values into ArrayList and put a loop to find out the duplicate values and delete.
    2. With less code for removing repeated string is to add ArrayList to a Set (as it will not allow duplicates) and then add the Set back to ArrayList

    ArrayList hamArrList = new ArrayList();
    /* Add all the data to hamArrList */
    HashSet hamHSet = new HashSet();
    hamHSet.addAll(hamArrList);
    /* To clear ArrayList'd data */
    hamArrList.clear();
    /* Now add the Set back to ArrayList */
    hamArrList.add(hamHSet);


    Thanks,
    Hamendra

    Add comment
    10|10000 characters needed characters exceeded