Add function that transforms a Sone into its nice name.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 9 Nov 2013 15:33:47 +0000 (16:33 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 28 Feb 2014 21:25:58 +0000 (22:25 +0100)
src/main/java/net/pterodactylus/sone/data/Sone.java

index 8d270c3..a8e8009 100644 (file)
@@ -108,6 +108,13 @@ public interface Sone extends Identified, Fingerprintable, Comparable<Sone> {
 
        };
 
+       public static final Function<Sone, String> TO_NICE_NAME = new Function<Sone, String>() {
+               @Override
+               public String apply(Sone sone) {
+                       return (sone == null) ? null : getNiceName(sone);
+               }
+       };
+
        /** Comparator that sorts Sones by last activity (least recent active first). */
        public static final Comparator<Sone> LAST_ACTIVITY_COMPARATOR = new Comparator<Sone>() {