Why there is no getFirst(iterable) method?
问题 Iterables present two methods for getLast public static <T> T getLast(Iterable<T> iterable); public static <T> T getLast(Iterable<T> iterable, @Nullable T defaultValue); but only one for getFirst public static <T> T getFirst(Iterable<T> iterable, @Nullable T defaultValue); Is there are any design/implementation reason for breaking symmetry? 回答1: I think the point is that there is no reason for a getFirst(iterable) in that this could be done with iterable.iterator().next() . Guava makes an