Created
March 25, 2020 21:55
-
-
Save kaansonmezoz/911da755e26bee43206addb2093e5372 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public List<Trip> getTripsByUser(User user) throws UserNotLoggedInException { | |
| User loggedUser = UserSession.getInstance().getLoggedUser(); | |
| if(loggedUser == null){ | |
| throw new UserNotLoggedInException(); | |
| } | |
| return isFriend(user.getFriends(), loggedUser) ? | |
| TripDAO.findTripsByUser(user) : new ArrayList<Trip>(); | |
| } | |
| private boolean isFriendOf(User user, User loggedUser){ | |
| return user.getFriends().contains(loggedUser); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment