From b4aa901eb74222ef576aa429c346ac7c19010b0e Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 28 Oct 2013 21:52:35 +0100 Subject: [PATCH] Add a function to transform a Sone into its posts. --- src/main/java/net/pterodactylus/sone/data/Sone.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/data/Sone.java b/src/main/java/net/pterodactylus/sone/data/Sone.java index 989c6a1..a8830f8 100644 --- a/src/main/java/net/pterodactylus/sone/data/Sone.java +++ b/src/main/java/net/pterodactylus/sone/data/Sone.java @@ -24,6 +24,7 @@ import static net.pterodactylus.sone.data.Album.FLATTENER; import static net.pterodactylus.sone.data.Album.IMAGES; import java.util.Collection; +import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Set; @@ -178,6 +179,13 @@ public interface Sone extends Identified, Fingerprintable, Comparable { } }; + public static final Function> TO_POSTS = new Function>() { + @Override + public List apply(Sone sone) { + return (sone == null) ? Collections.emptyList() : sone.getPosts(); + } + }; + /** * Returns the identity of this Sone. * -- 2.7.4