app/controllers/DestinationsController.java
private List<Destination> loadCurrentUserDestinationPhotos(int profileId, List<Destination> destinationsListGot) {
        Optional<List<Photo>> imageList = personalPhotoRepository.getAllProfilePhotos(profileId);
        if (imageList.isPresent()) {
            for (Destination destination : destinationsListGot) {
                List<Photo> destPhotoList = new ArrayList<>();
                for (Photo photo : imageList.get()) {
                    if (destinationPhotoRepository.findByProfileIdPhotoIdDestId(profileId, photo.getPhotoId(), destination.getDestinationId()).isPresent()) {
                        destPhotoList.add(photo);
                    }
                }
                destination.setUsersPhotos(destPhotoList);
            }
            return destinationsListGot;
        }
        return destinationsListGot;
    }
/**
     * takes in a list of destinations, for each destination loads the photos which are linked to that destination and
     * owned by the current user into destination.usersPhotos
     *
     * @param destinationsListGot
     * @return destinationsListGot
     */
takes in a list of destinations, for each destination loads the photos which are linked to that destination and
owned by the current user into destination.usersPhotos


takes in a list of destinations for each destination loads the photos which are linked to that destination and owned by the current user into destination . usersPhotos
private List<Destination> loadCurrentUserDestinationPhotos(int profileId, List<Destination> destinationsListGot) {
        Optional<List<Photo>> imageList = personalPhotoRepository.getAllProfilePhotos(profileId);
        if (imageList.isPresent()) {
            for (Destination destination : destinationsListGot) {
                List<Photo> destPhotoList = new ArrayList<>();
                for (Photo photo : imageList.get()) {
                    if (destinationPhotoRepository.findByProfileIdPhotoIdDestId(profileId, photo.getPhotoId(), destination.getDestinationId()).isPresent()) {
                        destPhotoList.add(photo);
                    }
                }
                destination.setUsersPhotos(destPhotoList);
            }
            return destinationsListGot;
        }
        return destinationsListGot;
    }
private List < Destination > loadCurrentUserDestinationPhotos ( int profileId , List < Destination > destinationsListGot ) { Optional < List < Photo > > imageList = personalPhotoRepository . getAllProfilePhotos ( profileId ) ; if ( imageList . isPresent ( ) ) { for ( Destination destination : destinationsListGot ) { List < Photo > destPhotoList = new ArrayList < > ( ) ; for ( Photo photo : imageList . get ( ) ) { if ( destinationPhotoRepository . findByProfileIdPhotoIdDestId ( profileId , photo . getPhotoId ( ) , destination . getDestinationId ( ) ) . isPresent ( ) ) { destPhotoList . add ( photo ) ; } } destination . setUsersPhotos ( destPhotoList ) ; } return destinationsListGot ; } return destinationsListGot ; }
takes in a list of destinations, for each destination loads the photos which are linked to that destination and
 owned by the current user into destination.usersPhotos
takes in a list of destinations for each destination loads the photos which are linked to that destination and owned by the current user into destination . usersPhotos