get first value from set java code example
Example 1: get first entry in set java
Set<Long> set = new LinkedHashSet<>();
set.iterator().next();
// LinkedHashSet guarantees insertion order
Example 2: java list get first element
set.iterator().next();
Example 3: java list get first element
!list_or_set.isEmpty()