aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-12-24 03:15:44 +0300
committerGravatar Vitaly Takmazov2022-12-24 03:15:44 +0300
commit2a858017b7d9a620d1083b69b7ca038c34a5ba89 (patch)
tree3b192b9ab0aee2a38bbd3243a2977409ae6a033e /src/main/java/com/juick/www
parent54f27794e7fee1113115baafe1b86fdbcde8e7c2 (diff)
`Collectors.toList()` -> `toList()`
Diffstat (limited to 'src/main/java/com/juick/www')
-rw-r--r--src/main/java/com/juick/www/api/Notifications.java6
-rw-r--r--src/main/java/com/juick/www/api/activity/Profile.java8
-rw-r--r--src/main/java/com/juick/www/controllers/Settings.java2
-rw-r--r--src/main/java/com/juick/www/controllers/Site.java14
-rw-r--r--src/main/java/com/juick/www/rss/MessagesView.java2
-rw-r--r--src/main/java/com/juick/www/rss/RepliesView.java2
6 files changed, 17 insertions, 17 deletions
diff --git a/src/main/java/com/juick/www/api/Notifications.java b/src/main/java/com/juick/www/api/Notifications.java
index 5f941ba5..09dad9e2 100644
--- a/src/main/java/com/juick/www/api/Notifications.java
+++ b/src/main/java/com/juick/www/api/Notifications.java
@@ -76,11 +76,11 @@ public class Notifications {
pushQueriesService.getMPNSURL(uid).forEach(t -> user.getTokens().add(new ExternalToken(null, "mpns", t, null)));
List<ExternalToken> xmppJids = userService.getJIDsbyUID(uid).stream()
.map(jid -> new ExternalToken(null, "xmpp", jid, null))
- .collect(Collectors.toList());
+ .toList();
user.getTokens().addAll(xmppJids);
List<ExternalToken> tgIds = telegramService.getTelegramIdentifiers(Collections.singletonList(user)).stream()
.map(tgId -> new ExternalToken(null, "durov", String.valueOf(tgId), null))
- .collect(Collectors.toList());
+ .toList();
user.getTokens().addAll(tgIds);
return user;
}
@@ -116,7 +116,7 @@ public class Notifications {
}
return users.stream().map(User::getUid)
- .map(this::collectTokens).collect(Collectors.toList());
+ .map(this::collectTokens).toList();
} else {
// read
return Collections.singletonList(collectTokens(uid));
diff --git a/src/main/java/com/juick/www/api/activity/Profile.java b/src/main/java/com/juick/www/api/activity/Profile.java
index c87d6118..fb66400d 100644
--- a/src/main/java/com/juick/www/api/activity/Profile.java
+++ b/src/main/java/com/juick/www/api/activity/Profile.java
@@ -142,7 +142,7 @@ public class Profile {
String personUri = uri.path(String.format("/u/%s", userName)).toUriString();
List<Integer> mids = messagesService.getUserBlog(user.getUid(), 0, before);
List<Note> notes = messagesService.getMessages(visitor, mids).stream().map(activityPubManager::makeNote)
- .collect(Collectors.toList());
+ .toList();
OrderedCollectionPage page = new OrderedCollectionPage();
page.setPartOf(uri.replacePath(String.format("/u/%s/blog/toc", userName)).toUriString());
page.setFirst(uri.replacePath(String.format("/u/%s/blog", userName)).toUriString());
@@ -155,7 +155,7 @@ public class Profile {
create.setObject(a);
create.setPublished(a.getPublished());
return create;
- }).collect(Collectors.toList()));
+ }).toList());
int beforeNext = mids.stream().reduce((fst, second) -> second).orElse(0);
if (beforeNext > 0) {
page.setNext(uri.queryParam("before", beforeNext).toUriString());
@@ -200,7 +200,7 @@ public class Profile {
follower.setPreferredUsername(a.getName());
follower.setUrl(profileUriBuilder.personWebUri(a));
return follower;
- }).collect(Collectors.toList()));
+ }).toList());
boolean hasNext = followers.size() <= 20 * page;
if (hasNext) {
result.setNext(uriComponentsBuilder.queryParam("page", page + 1).toUriString());
@@ -244,7 +244,7 @@ public class Profile {
follower.setPreferredUsername(a.getName());
follower.setUrl(profileUriBuilder.personWebUri(a));
return follower;
- }).collect(Collectors.toList()));
+ }).toList());
boolean hasNext = following.size() <= 20 * page;
if (hasNext) {
result.setNext(uriComponentsBuilder.queryParam("page", page + 1).toUriString());
diff --git a/src/main/java/com/juick/www/controllers/Settings.java b/src/main/java/com/juick/www/controllers/Settings.java
index 0b486766..b990bf41 100644
--- a/src/main/java/com/juick/www/controllers/Settings.java
+++ b/src/main/java/com/juick/www/controllers/Settings.java
@@ -107,7 +107,7 @@ public class Settings {
model.addAttribute("emails", userService.getEmails(visitor));
model.addAttribute("jids", userService.getAllJIDs(visitor));
List<String> hours = IntStream.rangeClosed(0, 23).boxed()
- .map(i -> StringUtils.leftPad(String.format("%d", i), 2, "0")).collect(Collectors.toList());
+ .map(i -> StringUtils.leftPad(String.format("%d", i), 2, "0")).toList();
model.addAttribute("hours", hours);
model.addAttribute("fbstatus", userService.getFbCrossPostStatus(visitor.getUid()));
model.addAttribute("twitter_name", userService.getTwitterName(visitor.getUid()));
diff --git a/src/main/java/com/juick/www/controllers/Site.java b/src/main/java/com/juick/www/controllers/Site.java
index dcb89718..dadf7ed6 100644
--- a/src/main/java/com/juick/www/controllers/Site.java
+++ b/src/main/java/com/juick/www/controllers/Site.java
@@ -95,7 +95,7 @@ public class Site {
model.addAttribute("tagStats",
tagService.getUserTagStats(user.getUid()).stream()
.sorted((e1, e2) -> Integer.compare(e2.getUsageCount(), e1.getUsageCount())).limit(20)
- .map(t -> t.getTag().getName()).collect(Collectors.toList()));
+ .map(t -> t.getTag().getName()).toList());
}
@GetMapping("/login")
@@ -195,7 +195,7 @@ public class Site {
List<Integer> unread = messagesService.getUnread(visitor);
visitor.setUnreadCount(unread.size());
List<Integer> blUIDs = userService.checkBL(visitor.getUid(),
- msgs.stream().map(m -> m.getUser().getUid()).collect(Collectors.toList()));
+ msgs.stream().map(m -> m.getUser().getUid()).toList());
msgs.forEach(m -> m.ReadOnly |= blUIDs.contains(m.getUser().getUid()));
}
model.addAttribute("msgs", msgs);
@@ -301,7 +301,7 @@ public class Site {
List<Integer> unread = messagesService.getUnread(visitor);
visitor.setUnreadCount(unread.size());
List<Integer> blUIDs = userService.checkBL(visitor.getUid(),
- msgs.stream().map(m -> m.getUser().getUid()).collect(Collectors.toList()));
+ msgs.stream().map(m -> m.getUser().getUid()).toList());
msgs.forEach(m -> m.ReadOnly |= blUIDs.contains(m.getUser().getUid()));
}
model.addAttribute("msgs", msgs);
@@ -338,7 +338,7 @@ public class Site {
model.addAttribute("tags",
tagService.getUserTagStats(user.getUid()).stream()
.sorted((e1, e2) -> Integer.compare(e2.getUsageCount(), e1.getUsageCount()))
- .map(t -> t.getTag().getName()).collect(Collectors.toList()));
+ .map(t -> t.getTag().getName()).toList());
return "views/blog_tags";
}
@@ -423,7 +423,7 @@ public class Site {
List<Integer> unread = messagesService.getUnread(visitor);
visitor.setUnreadCount(unread.size());
List<Integer> blUIDs = userService.checkBL(visitor.getUid(),
- msgs.stream().map(m -> m.getUser().getUid()).collect(Collectors.toList()));
+ msgs.stream().map(m -> m.getUser().getUid()).toList());
msgs.forEach(m -> m.ReadOnly |= blUIDs.contains(m.getUser().getUid()));
fillUserModel(model, visitor, visitor);
}
@@ -569,7 +569,7 @@ public class Site {
model.addAttribute("visitorSubscribed", messagesService.isSubscribed(visitor.getUid(), msg.getMid()));
model.addAttribute("visitorInBL", userService.isInBL(msg.getUser().getUid(), visitor.getUid()));
model.addAttribute("recomm", messagesService.getMessagesRecommendations(Collections.singletonList(msg.getMid()))
- .stream().map(Pair::getRight).collect(Collectors.toList()));
+ .stream().map(Pair::getRight).toList());
List<Integer> blUIDs = new ArrayList<>();
for (Message reply : replies) {
if (reply.getUser().getUid() != msg.getUser().getUid() && !blUIDs.contains(reply.getUser().getUid())) {
@@ -609,7 +609,7 @@ public class Site {
model.addAttribute("tags",
tagService.getUserTagStats(visitor.getUid()).stream()
.sorted((e1, e2) -> Integer.compare(e2.getUsageCount(), e1.getUsageCount()))
- .map(t -> t.getTag().getName()).collect(Collectors.toList()));
+ .map(t -> t.getTag().getName()).toList());
return "views/post";
}
diff --git a/src/main/java/com/juick/www/rss/MessagesView.java b/src/main/java/com/juick/www/rss/MessagesView.java
index dde67d7b..71d63754 100644
--- a/src/main/java/com/juick/www/rss/MessagesView.java
+++ b/src/main/java/com/juick/www/rss/MessagesView.java
@@ -84,7 +84,7 @@ public class MessagesView extends AbstractRssFeedView {
protected List<Item> buildFeedItems(Map<String, Object> model, HttpServletRequest request,
HttpServletResponse response) {
List<Message> msgs = (List<Message>) model.get("messages");
- return msgs.stream().map(this::createRssItem).collect(Collectors.toList());
+ return msgs.stream().map(this::createRssItem).toList();
}
@Override
diff --git a/src/main/java/com/juick/www/rss/RepliesView.java b/src/main/java/com/juick/www/rss/RepliesView.java
index 83c8e104..80548a79 100644
--- a/src/main/java/com/juick/www/rss/RepliesView.java
+++ b/src/main/java/com/juick/www/rss/RepliesView.java
@@ -65,7 +65,7 @@ public class RepliesView extends AbstractRssFeedView {
HttpServletRequest request,
HttpServletResponse response) {
List<ResponseReply> msgs = (List<ResponseReply>)model.get("messages");
- return msgs.stream().map(this::createRssItem).collect(Collectors.toList());
+ return msgs.stream().map(this::createRssItem).toList();
}
@Override