I want to get the object of a collection that I know has exactly one element (basically it's the reverse of what Collections.singletonList() does - but I don't know whether the collection is list/set/something else so I can't use c.get(0)).
Currently I use c.iterator.next(), wonder if there is already a method for that in Java or one of the common libraries (apache-commons, guava etc.)