package net.pterodactylus.sone.data;
-import java.util.Collections;
import java.util.List;
-import javax.annotation.Nonnull;
-
-import com.google.common.base.Function;
/**
* Container for images that can also contain nested {@link Album}s.
*/
public interface Album extends Identified, Fingerprintable {
- /** Function that transforms an album into the images it contains. */
- Function<Album, List<Image>> IMAGES = new Function<Album, List<Image>>() {
-
- @Override
- @Nonnull
- public List<Image> apply(Album album) {
- return (album != null) ? album.getImages() : Collections.<Image>emptyList();
- }
- };
-
/**
* Returns the ID of this album.
*
package net.pterodactylus.sone.template;
import static java.util.logging.Logger.getLogger;
-import static java.util.stream.Collectors.toList;
-import static net.pterodactylus.sone.data.Album.IMAGES;
import java.util.logging.Level;
import java.util.logging.Logger;
}
return trust;
} else if (member.equals("allImages")) {
- return SoneKt.getAllAlbums(sone).stream().flatMap(a -> IMAGES.apply(a).stream()).collect(toList());
+ return SoneKt.getAllImages(sone);
} else if (member.equals("albums")) {
return sone.getRootAlbum().getAlbums();
}