first value of a list java code example Example 1: java list get first element set.iterator().next(); Example 2: java list get first element !list_or_set.isEmpty()