From f419d57f54019c51bb5ee238515a0552381ed358 Mon Sep 17 00:00:00 2001 From: John Baringhaus Date: Thu, 7 Jul 2022 21:42:40 -0400 Subject: [PATCH] Moved UserList.data initialization into UserList from TwitterClient --- src/main/java/io/github/redouane59/twitter/TwitterClient.java | 2 +- .../java/io/github/redouane59/twitter/dto/user/UserList.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/redouane59/twitter/TwitterClient.java b/src/main/java/io/github/redouane59/twitter/TwitterClient.java index 2093ccb9..383b3e66 100644 --- a/src/main/java/io/github/redouane59/twitter/TwitterClient.java +++ b/src/main/java/io/github/redouane59/twitter/TwitterClient.java @@ -462,7 +462,7 @@ public UserList getRetweetingUsers(String tweetId, int maxResults) { * Used for get liking users, get retweeting users and get members endpoints recursively calls */ private UserList getUsersRecursively(int maxResults, String url, Map parameters) { - UserList result = UserList.builder().data(new ArrayList<>()).meta(new UserMeta()).build(); + UserList result = UserList.builder().meta(new UserMeta()).build(); String next; do { diff --git a/src/main/java/io/github/redouane59/twitter/dto/user/UserList.java b/src/main/java/io/github/redouane59/twitter/dto/user/UserList.java index 9398afa1..477f3b02 100644 --- a/src/main/java/io/github/redouane59/twitter/dto/user/UserList.java +++ b/src/main/java/io/github/redouane59/twitter/dto/user/UserList.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.github.redouane59.twitter.dto.user.UserV2.UserData; +import java.util.ArrayList; import java.util.List; import lombok.AllArgsConstructor; import lombok.Builder; @@ -16,7 +17,7 @@ @AllArgsConstructor public class UserList { - private List data; + private List data = new ArrayList<>(); private UserMeta meta; @Getter