how to get the first element in a set java code example Example 1: java list get first element list.get(0); Example 2: java list get first element set.iterator().next();