I have List with some users from google and now in stream I say for every google user make new HRVacationUser ( witch is model ) and give me ( their email, some random date, some random date ) which random date is for random holiday. But in that case i set each user is on vacantion. How can I take random user from google users and set random date for holiday, so I can make a request in the database - give me this user which is in holiday?
My List /GoogleUser> is with size for example 80, and I want to set only for random users vacantion date, and then to make request if(user is in vacantion return 'user') and in database to do request give me holiday users
public List<HRVacationUser> listVacationGoogleUsers(List<GoogleUser> allGoogleUsers){
LocalDate date = LocalDate.now();
List<HRVacationUser> collectHRUser = allGoogleUsers.stream()
.map(user ->
new HRVacationUser(user.getPrimaryEmail(), date.minusDays(ThreadLocalRandom.current().nextInt(1,5)), date.plusDays(ThreadLocalRandom.current().nextInt(1, 5))))
.collect(toList());
return collectHRUser;
}