From 0ae4db6f172db754840808595719c595dcc7b7bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 16 Oct 2013 21:03:59 +0200 Subject: [PATCH] Add function that transforms a post into its replies. --- src/main/java/net/pterodactylus/sone/data/Post.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/data/Post.java b/src/main/java/net/pterodactylus/sone/data/Post.java index 145170d..20bf518 100644 --- a/src/main/java/net/pterodactylus/sone/data/Post.java +++ b/src/main/java/net/pterodactylus/sone/data/Post.java @@ -17,9 +17,11 @@ package net.pterodactylus.sone.data; +import java.util.Collections; import java.util.Comparator; import java.util.List; +import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.base.Predicate; @@ -51,6 +53,13 @@ public interface Post extends Identified { }; + public static final Function> TO_REPLIES = new Function>() { + @Override + public List apply(Post post) { + return (post == null) ? Collections.emptyList() : post.getReplies(); + } + }; + // // ACCESSORS // -- 2.7.4