MCPcopy Create free account
hub / github.com/antlr/codebuff / getLast

Method getLast

output/java_guava/1.4.16/Iterators.java:878–885  ·  view source on GitHub ↗

Advances iterator to the end, returning the last element. @return the last element of iterator @throws NoSuchElementException if the iterator is empty

(Iterator<T> iterator)

Source from the content-addressed store, hash-verified

876
877
878 public static <T> T getLast(Iterator<T> iterator) {
879 while (true) {
880 T current = iterator.next();
881 if (!iterator.hasNext()) {
882 return current;
883 }
884 }
885 }
886
887 /**
888 * Advances {@code iterator} to the end, returning the last element or

Callers 1

getLastMethod · 0.95

Calls 2

nextMethod · 0.65
hasNextMethod · 0.45

Tested by

no test coverage detected