/** * @author lautturi.com * Java example: get the */ get the first element of the set in java import java.util.*; public class Lautturi { public static void main(String[] args) { Set<Integer> set = new HashSet<>(); set.add(1); set.add(2); set.add(3); Integer firstElement = set.iterator().next(); System.out.println(firstElement); } }