Java Set Sort sort(Set data)

Here you can find the source of sort(Set data)

Description

sort

License

Open Source License

Declaration

public static List sort(Set data) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

public class Main {
    public static List sort(Set data) {
        List list = new ArrayList();
        for (Iterator it = data.iterator(); it.hasNext();) {
            list.add(it.next());/*from   w  w  w  . ja v a  2 s. com*/
        }
        Collections.sort(list, (Object o1, Object o2) -> o1.toString().compareTo(o2.toString()));
        return list;
    }
}

Related

  1. sort( Collection> entrySet)
  2. sortByToCloseOrder(Set set)
  3. sortedSetToString(SortedSet sortedSet)
  4. sortKeys(final Set keySet)
  5. sortKeys(Set unsortedKeys)