Skip to content

Task #8 Completed - #7

Open
Valamer wants to merge 1 commit into
masterfrom
Task-8
Open

Task #8 Completed#7
Valamer wants to merge 1 commit into
masterfrom
Task-8

Conversation

@Valamer

@Valamer Valamer commented May 14, 2024

Copy link
Copy Markdown
Owner

No description provided.

@mkharkhuta mkharkhuta left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good but please fix the naming

Comment thread src/Streams.java
import java.util.stream.Collectors;

public class Streams {
public static List<Product> GetExpensiveBooks (List<Product> products) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please follow Java naming convention for method name

Comment thread src/Streams.java
public static Product GetCheapestBook (List<Product> products) {
return products.stream().filter(product -> product.getType().equals("Book"))
.reduce((first, second) -> first.getPrice() < second.getPrice() ? first : second)
.orElseThrow(() -> new RuntimeException("Product [category: category_name] not found"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Category name should be gotten from the product type

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