The method comes with a map with the user name key and a Boolean value. The user names are the same as in the database.From the database comes a list of entities in which the user name and password. I need to compare the user names from the list of entities and the user names from the map in the flow and leave only those entities that have the same user name and the value " true"
public class BasicAuthUser {
private String username;
private String password;
}
private void create(Map<String, Boolean> users) {
var allUsersFromDB = basicAuthUserService.getAllUsers(); //List<BasicAuthUsers>
var credentials = allUsersFromDB.stream()
.filter ( ? )//basicAuthUser.getUsername().equals(users.getKey)&&users.getValue.equals(Boolean.TRUE)
.map(user -> user.getUsername(),user.getPassword())
.collect(Collectors.joining());
}