From b1267ab73fd601dcc1636a64d86135d72631b525 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 15 Dec 2022 20:25:15 +0300 Subject: Apply IDEA suggestions --- src/main/java/com/juick/service/SubscriptionServiceImpl.java | 8 ++++---- .../com/juick/www/api/activity/helpers/ContextTypeFilter.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/src/main/java/com/juick/service/SubscriptionServiceImpl.java index ca813c67..0b8d9f26 100644 --- a/src/main/java/com/juick/service/SubscriptionServiceImpl.java +++ b/src/main/java/com/juick/service/SubscriptionServiceImpl.java @@ -66,13 +66,13 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip List users = ListUtils.union(subscribers, mentionedUsers); List tags = tagService.getMessageTagsIDs(mid); List tagsStr = tagService.getMessageTags(mid).stream().map(t -> t.getTag().getName()) - .collect(Collectors.toList()); + .toList(); - Set set = new HashSet<>(users.stream() + Set set = users.stream() .filter(u -> !u.isBanned()) .map(User::getUid) .filter(u -> Collections.disjoint(tagService.getUserBLTags(u), tagsStr)) - .collect(Collectors.toList())); + .collect(Collectors.toSet()); if (!tags.isEmpty()) { List tagUsers = getNamedParameterJdbcTemplate().queryForList( @@ -118,7 +118,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip @Override public List getUsersSubscribedToUserRecommendations(final int uid, final Message msg) { List msgTags = tagService.getMessageTags(msg.getMid()).stream().map(t -> t.getTag().getName()) - .collect(Collectors.toList()); + .toList(); if (msg.getLikes() == 1) { return userService.getUserReaders(uid).stream() .filter(u -> !u.equals(msg.getUser())) diff --git a/src/main/java/com/juick/www/api/activity/helpers/ContextTypeFilter.java b/src/main/java/com/juick/www/api/activity/helpers/ContextTypeFilter.java index e8a1dfab..475e15bf 100644 --- a/src/main/java/com/juick/www/api/activity/helpers/ContextTypeFilter.java +++ b/src/main/java/com/juick/www/api/activity/helpers/ContextTypeFilter.java @@ -21,9 +21,9 @@ public class ContextTypeFilter { @Override public boolean equals(Object obj) { - if (obj == null || !(obj instanceof String)) { + if (!(obj instanceof String)) { return true; } - return ((String)obj).equals("Context"); + return obj.equals("Context"); } } -- cgit v1.2.3