Skip to content

Conversation

@oliviarla
Copy link
Member

No description provided.

Copy link

@this-is-spear this-is-spear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

늦게 리뷰드려서 죄송합니다. 😿
이번 미션을 진행하면서 저도 많이 배웠던 것 같아요!
이번 미션 수고 많으셨습니다. 🙇‍♂️

Comment on lines +33 to 35
public interface Conditional {
boolean test(Integer number);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Condition 인터페이스를 내부에 선언하신 이유가 있으실까요?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그리고 test 말고도 좋은 메서드 이름이 있을 것 같아요!

Comment on lines 42 to +47
public static int sumAllEven(List<Integer> numbers) {
int total = 0;
for (int number : numbers) {
if (number % 2 == 0) {
total += number;
}
}
return total;
return sumAll(numbers, (integer)->{return integer%2==0;});
}

public static int sumAllOverThree(List<Integer> numbers) {
int total = 0;
for (int number : numbers) {
if (number > 3) {
total += number;
}
}
return total;
return sumAll(numbers, (integer)->{return integer>3;});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

조건들도 메서드로 선언해서 깔끔하게 관리하는 것도 좋아보여요!

List<String> words = Arrays.asList(contents.split("[\\P{L}]+"));

// TODO 이 부분에 구현한다.
words.stream().filter(w -> w.length() > 12).sorted(Comparator.comparing(String::length).reversed()).distinct().limit(100).map(String::toLowerCase).forEach(System.out::println);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 방식으로 조건들을 한 번에 해결할 수 있군요! 멋집니다. 👍


public static boolean ageIsInRange2(User user) {
return false;
return Optional.ofNullable(user).map(x -> x.getAge()).filter(x -> x >=30 && x <= 45).isPresent();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

람다를 추가적으로 사용할 수 있습니다. ☺️

Suggested change
return Optional.ofNullable(user).map(x -> x.getAge()).filter(x -> x >=30 && x <= 45).isPresent();
return Optional.ofNullable(user).map(User::getAge).filter(x -> x >=30 && x <= 45).isPresent();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x >=30 && x <= 45와 같은 조건을 의미있는 이름으로 메서드를 만들면 가독성이 더 좋을 것 같아요!

return true;
}
});
Car actual = car.move(() -> {return true;});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Car actual = car.move(() -> {return true;});
Car actual = car.move(() -> true);

return false;
}
});
Car actual = car.move(() ->{return false;});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Car actual = car.move(() ->{return false;});
Car actual = car.move(() -> false);

}
}
return DEFAULT_USER;
return users.stream().filter(user -> user.matchName(name)).findAny().orElse(DEFAULT_USER);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findAny() 메서드를 사용하신 이유가 있을까요? ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants