diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-02-16 21:29:30 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-02-16 21:29:30 +0000 |
| commit | 0ea271afbea406a9ebeb24712255a50cbbd5c83d (patch) | |
| tree | 4e0229b754ed3aefde664acec049a86417a265be /src/main/java/org/zwobble/mammoth/util/MammothIterables.java | |
| parent | 87527240deb25cc9b62b8aa43c8121344fc103f7 (diff) | |
Collapse nodes where appropriate
Diffstat (limited to 'src/main/java/org/zwobble/mammoth/util/MammothIterables.java')
| -rw-r--r-- | src/main/java/org/zwobble/mammoth/util/MammothIterables.java | 11 |
1 files changed, 11 insertions, 0 deletions
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 <T> Optional<T> tryGetLast(Iterable<T> iterable) { + return Optional.ofNullable(Iterables.getLast(iterable, null)); + } +} |
