java set get first element 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
list.get(0);
Example 3: java list get first element
!list_or_set.isEmpty()
Example 4: how to find first value of an list
// Python
list = [1,2,3]
firstdigit = list[0] // 1
list = ['Hello', 'bye', 'Adios']
firstvalue = list[0] // 'Hello'