Convert some usages of Function to lambda Change-Id: Ifeccf4a117527edb4c2be28b3b9205d153a6cdd7
diff --git a/gitiles-servlet/src/main/java/com/google/gitiles/RefServlet.java b/gitiles-servlet/src/main/java/com/google/gitiles/RefServlet.java index 5aa4119..d40962b 100644 --- a/gitiles-servlet/src/main/java/com/google/gitiles/RefServlet.java +++ b/gitiles-servlet/src/main/java/com/google/gitiles/RefServlet.java
@@ -17,7 +17,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND; -import com.google.common.base.Function; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -139,19 +138,17 @@ limit); } - private static Ordering<Ref> tagComparator(final TimeCache timeCache, final RevWalk walk) { + private static Long getTime(RevWalk walk, TimeCache timeCache, Ref ref) { + try { + return timeCache.getTime(walk, ref.getObjectId()); + } catch (IOException e) { + throw new UncheckedExecutionException(e); + } + } + + private static Ordering<Ref> tagComparator(TimeCache timeCache, RevWalk walk) { return Ordering.natural() - .onResultOf( - new Function<Ref, Long>() { - @Override - public Long apply(Ref ref) { - try { - return timeCache.getTime(walk, ref.getObjectId()); - } catch (IOException e) { - throw new UncheckedExecutionException(e); - } - } - }) + .onResultOf((Ref r) -> getTime(walk, timeCache, r)) .reverse() .compound(RefComparator.INSTANCE); }