Tuesday, February 24, 2015

How to sort a hashset

Covert set into list than sort it using collection utill
A HashSet does not guarantee any order of its elements


Set unSortedHashSet = new HashSet();

List sortedList = new ArrayList(unSortedHashSet);

Collections.sort(sortedList);

No comments:

Post a Comment