app/controllers/DestinationsController.java
private List<Destination> loadWorldDestPhotos(int profileId, List<Destination> destinationsList) {
        Optional<List<Photo>> optionalImageList = destinationPhotoRepository.getAllDestinationPhotos();
        if (optionalImageList.isPresent()) {
            List<Photo> photoList = optionalImageList.get();
            for (Destination destination : destinationsList) {
                List<Photo> destPhotoList = new ArrayList<>();
                for (Photo photo : photoList) {
                    if (destinationPhotoRepository.isLinkedToDestByOtherUser(profileId, photo.getPhotoId(), destination.getDestinationId())) {
                        destPhotoList.add(photo);
                    }
                }
                destination.setWorldPhotos(destPhotoList);
            }
            return destinationsList;
        }
        return destinationsList;
    }
/**
     * takes in a list of destinations, for each destination loads the photos which are linked to that destination but
     * not from the current user. ie: the world destination photos
     *
     * @param profileId,        the id of the current user, will not add their destination photos to the list
     * @param destinationsList, a list of the destinations which it will be adding photos to
     * @return destinations list that was passed in
     */
takes in a list of destinations, for each destination loads the photos which are linked to that destination but
not from the current user. ie: the world destination photos

@param profileId,        the id of the current user, will not add their destination photos to the list
@param destinationsList, a list of the destinations which it will be adding photos to
@return destinations list that was passed in
takes in a list of destinations for each destination loads the photos which are linked to that destination but not from the current user . ie : the world destination photos @param profileId the id of the current user will not add their destination photos to the list @param destinationsList a list of the destinations which it will be adding photos to @return destinations list that was passed in
private List<Destination> loadWorldDestPhotos(int profileId, List<Destination> destinationsList) {
        Optional<List<Photo>> optionalImageList = destinationPhotoRepository.getAllDestinationPhotos();
        if (optionalImageList.isPresent()) {
            List<Photo> photoList = optionalImageList.get();
            for (Destination destination : destinationsList) {
                List<Photo> destPhotoList = new ArrayList<>();
                for (Photo photo : photoList) {
                    if (destinationPhotoRepository.isLinkedToDestByOtherUser(profileId, photo.getPhotoId(), destination.getDestinationId())) {
                        destPhotoList.add(photo);
                    }
                }
                destination.setWorldPhotos(destPhotoList);
            }
            return destinationsList;
        }
        return destinationsList;
    }
private List < Destination > loadWorldDestPhotos ( int profileId , List < Destination > destinationsList ) { Optional < List < Photo > > optionalImageList = destinationPhotoRepository . getAllDestinationPhotos ( ) ; if ( optionalImageList . isPresent ( ) ) { List < Photo > photoList = optionalImageList . get ( ) ; for ( Destination destination : destinationsList ) { List < Photo > destPhotoList = new ArrayList < > ( ) ; for ( Photo photo : photoList ) { if ( destinationPhotoRepository . isLinkedToDestByOtherUser ( profileId , photo . getPhotoId ( ) , destination . getDestinationId ( ) ) ) { destPhotoList . add ( photo ) ; } } destination . setWorldPhotos ( destPhotoList ) ; } return destinationsList ; } return destinationsList ; }
takes in a list of destinations, for each destination loads the photos which are linked to that destination but
 not from the current user.
takes in a list of destinations for each destination loads the photos which are linked to that destination but not from the current user .