Skip to content

Commit

Permalink
#18 [Refactor] for문 stream 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna-Jin committed Jul 28, 2022
1 parent a4d58dc commit 6eedd46
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/main/java/com/mpnp/baechelin/store/service/StoreService.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,12 @@ public StoreDetailResponseDto getStore(long storeId, String socialId) {

List<String> storeImageList = new ArrayList<>();

for (StoreImage storeImage : store.getStoreImageList()) {
storeImageList.add(storeImage.getStoreImageUrl());
}
store.getStoreImageList()
.forEach(storeImage -> storeImageList.add(storeImage.getStoreImageUrl()));

for (Review review : store.getReviewList()) {
for (ReviewImage reviewImage : review.getReviewImageList()) {
storeImageList.add(reviewImage.getReviewImageUrl());
}
}
store.getReviewList()
.forEach(review -> review.getReviewImageList()
.forEach(reviewImage -> storeImageList.add(reviewImage.getReviewImageUrl())));

if (socialId == null) {
return new StoreDetailResponseDto(store, "N", storeImageList);
Expand Down

0 comments on commit 6eedd46

Please sign in to comment.