From: David ‘Bombe’ Roden Date: Mon, 28 Oct 2013 20:52:35 +0000 (+0100) Subject: Add a function to transform a Sone into its posts. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=b4aa901eb74222ef576aa429c346ac7c19010b0e;p=Sone.git Add a function to transform a Sone into its posts. --- 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. *