SyntaxFix
Write A Post
Hire A Developer
Questions
In Java >=8 you could also use the Streaming API:
Optional<String> first = set.stream().findFirst();
(Useful if the Set/List may be empty.)