projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement getDirectedSones() differently, adhere to new post provider interface.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
core
/
Core.java
diff --git
a/src/main/java/net/pterodactylus/sone/core/Core.java
b/src/main/java/net/pterodactylus/sone/core/Core.java
index
582a5fd
..
bafe7a8
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/core/Core.java
+++ b/
src/main/java/net/pterodactylus/sone/core/Core.java
@@
-523,26
+523,21
@@
public class Core extends AbstractService implements SoneProvider, PostProvider,
}
/**
}
/**
- * Returns all posts that have the given Sone as recipient.
- *
- * @see Post#getRecipient()
- * @param recipient
- * The recipient of the posts
- * @return All posts that have the given Sone as recipient
+ * {@inheritDoc}
*/
*/
- public Set<Post> getDirectedPosts(Sone recipient) {
- checkNotNull(recipient, "recipient must not be null");
-
Set<Post> directedPosts = new HashSet<Post>(
);
+ @Override
+ public Collection<Post> getDirectedPosts(final String recipientId) {
+
checkNotNull(recipientId, "recipient must not be null"
);
synchronized (posts) {
synchronized (posts) {
- for (Post post : posts.values()) {
- if (recipient.equals(post.getRecipient())) {
- directedPosts.add(post);
+ return Collections2.filter(posts.values(), new Predicate<Post>() {
+
+ @Override
+ public boolean apply(Post post) {
+ return (post.getRecipient() != null) && (post.getRecipient().getId().equals(recipientId));
}
}
- }
+ }
);
}
}
- return directedPosts;
}
}
-
/**
* Returns a post reply builder.
*
/**
* Returns a post reply builder.
*