Unable add element to top of hashset
arraylist, hashset, java
Solution
`HashSet` is not an ordered version of a `Set`. Use `LinkedHashSet` when you need an ordered `Set` and `TreeSet` when you need a sorted one.
Problem
I was using arraylist to populate an optionscollection in jsp. Now i dont need duplicate elements.So i want to use hashset. If i use hashset , unlike arraylist if i want to display a blank if i add a blank as the first element and then add other data the blank is displaying at the end of the combobox. When i use arraylist if i add blank as the first element it displays at the start which is what i need. Can any one help me to add the blank at the beginning for hashset ?