Sort a Collection Set and extract the Nth element in Java

Hi all,

Please could tell me how to sort a collection set in java and store in a new field? 

And how to extract the second element of the sorted collection and store the result in another field?

Please find the workflow attached.

Thanks in advance

Regards

Hey,

I appended a workflow that does the job with nodes and without Java-Snippet for you.

Hope that helps.

Cheers,
Marten

Thank you very much. But my goal is to do this in Java to increase the speed (I need to do this for a very large dataset). How to do this in java?

Thanks in advance

If you are desperate to do it with a Java Snippet Node, I guess you should have a look into TreeSet: https://docs.oracle.com/javase/7/docs/api/java/util/TreeSet.html

Cheers
Marten