chibenwa commented on code in PR #2474: URL: https://github.com/apache/james-project/pull/2474#discussion_r1822117107
########## server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/UserRoutes.java: ########## @@ -164,6 +213,21 @@ public void defineAllowedFromHeaders() { jsonTransformer); } + private List<UserResponse> getUsers(Request request, Response response) throws UsersRepositoryException { + List<UserCondition> conditions = mapCondition.entrySet() + .stream() + .filter(entry -> request.queryParams().contains(entry.getKey())) + .map(Map.Entry::getValue) + .toList(); Review Comment: It would be more idiomatic to reduce the conditions into one: ``` interface UserCondition { static UserCondition ALL = any -> true; boolean satisfyCondition(UserResponse user); default UserCondition and(UserCondition other) { return user -> satisfyCondition(user) && other.satisfyCondition(user); } } ``` so that we can `.reduce(UserCOndition.ALL, UserCondition::and)` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org