From 0ea271afbea406a9ebeb24712255a50cbbd5c83d Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 16 Feb 2016 21:29:30 +0000 Subject: Collapse nodes where appropriate --- src/main/java/org/zwobble/mammoth/util/MammothIterables.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/main/java/org/zwobble/mammoth/util/MammothIterables.java (limited to 'src/main/java/org/zwobble/mammoth/util/MammothIterables.java') diff --git a/src/main/java/org/zwobble/mammoth/util/MammothIterables.java b/src/main/java/org/zwobble/mammoth/util/MammothIterables.java new file mode 100644 index 0000000..89caf61 --- /dev/null +++ b/src/main/java/org/zwobble/mammoth/util/MammothIterables.java @@ -0,0 +1,11 @@ +package org.zwobble.mammoth.util; + +import com.google.common.collect.Iterables; + +import java.util.Optional; + +public class MammothIterables { + public static Optional tryGetLast(Iterable iterable) { + return Optional.ofNullable(Iterables.getLast(iterable, null)); + } +} -- cgit v1.2.3