From: David ‘Bombe’ Roden Date: Mon, 8 Nov 2010 19:42:28 +0000 (+0100) Subject: Add method to check for the newness of a Sone. X-Git-Tag: 0.2.1~22 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0dc8ce4308f55d8f13e41c7ac312c11a379418b9;p=Sone.git Add method to check for the newness of a Sone. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 132e4a6..055ede4 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -323,6 +323,21 @@ public class Core implements IdentityListener { } /** + * Returns whether the given Sone is a new Sone. After this check, the Sone + * is marked as known, i.e. a second call with the same parameters will + * always yield {@code false}. + * + * @param sone + * The sone to check for + * @return {@code true} if the given Sone is new, false otherwise + */ + public boolean isNewSone(Sone sone) { + synchronized (newSones) { + return newSones.remove(sone); + } + } + + /** * Returns the post with the given ID. * * @param postId