static void main(String[] args) {
List<Foo> fooList = new LinkedList<>();
Set<Foo> fooSet = new HashSet<>();
Foo element1 = new Foo("Element1");
Foo element2 = new Foo("Element2");
Foo element3 = new Foo("Element3");
fooSet.add(element1);
fooSet.add(element2);
fooSet.add(element3);
CollectionUtils.addAll(fooList, fooSet);
}
Is there a way to convert from a Set to a List and guaranteeing element1 is the first element in the List? I do not care about the ordering for the rest of the elements in the List only the very first element. I could remove element1 from the Set then add it to the List then add the rest of the element. I'm just wondering what is the cleanest way to do this.