@@ -267,15 +267,13 @@ public List<BoomarkLikeResponseDto> getBookmarkandLikes(int pageNumber, int page
267
267
List <Bookmark > bookmarks = bookmarkRepository .findByUser (user );
268
268
List <UserLike > userLikes = userLikeRepository .findByUser (user );
269
269
270
- List <Spot > bookmarkedSpots ;
270
+ List <Spot > bookmarkedSpots = new ArrayList <>() ;
271
271
List <Spot > likedSpots = new ArrayList <>();
272
272
273
273
if (bookmarks != null ) {
274
274
bookmarkedSpots = bookmarks .stream ()
275
275
.map (Bookmark ::getSpot )
276
276
.collect (Collectors .toList ());
277
- } else {
278
- bookmarkedSpots = new ArrayList <>();
279
277
}
280
278
281
279
if (userLikes != null ) {
@@ -300,15 +298,17 @@ public List<BoomarkLikeResponseDto> getBookmarkandLikes(int pageNumber, int page
300
298
pageInfo .setSize (pageSize );
301
299
pageInfo .setTotalPages ((int ) Math .ceil ((double ) distinctSpots .size () / pageSize ));
302
300
303
- List <Spot > pagedDistinctSpots = distinctSpots .subList (start , end );
301
+ final List <Spot > finalBookmarkedSpots = bookmarkedSpots ; // 수정된 부분: final 변수로 선언
302
+ final List <Spot > finalLikedSpots = likedSpots ; // 수정된 부분: final 변수로 선언
304
303
305
- List <Spot > finalLikedSpots = likedSpots ;
304
+ List <Spot > pagedDistinctSpots = distinctSpots . subList ( start , end ) ;
306
305
307
306
return pagedDistinctSpots .stream ()
308
- .map (spot -> BoomarkLikeResponseDto .of (spot , bookmarkedSpots .contains (spot ), finalLikedSpots .contains (spot ), pageInfo ))
307
+ .map (spot -> BoomarkLikeResponseDto .of (spot , finalBookmarkedSpots .contains (spot ), finalLikedSpots .contains (spot ), pageInfo ))
309
308
.collect (Collectors .toList ());
310
309
}
311
310
312
311
313
312
313
+
314
314
}
0 commit comments