-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR - Fabio - Pratica de Lambda #4
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parabéns por se comprometer a desenvolver as atividades, em uma analise geral o código está bem satisfatório, adicionei umas dicas para evoluir seu código junto com uns pontos para refazer a atividade.
OBS: Formulei a atividade VIII incorretamente, queria realmente dizer:
VIII Mostra a categoria onde com os produtos mais caro;
VIII - Mostrar a categoria onde a soma dos produtos seja mais caro;
nomeProdutoList.forEach(s -> System.out.println(s)); | ||
} | ||
|
||
private static void somarTodosOsProdutosDaCategoriaEsporte() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Falta o filtro pela categoria esporte
produtoList.add(new Produto(573, "Tapete Geometrico", 114.00, "Lazer", true)); | ||
} | ||
|
||
public static void main(String[] args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OBS Muito atencioso da sua parte a nomeclatura dos métodos e os comentários identificando cada atividade
produtoLog(primeiroProduto); | ||
} | ||
|
||
private static void listarProdutosPorOrdemAlfabetica() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A atividade esta propondo retorna uma lista de produto e não uma lista de nomes somente
}); | ||
} | ||
|
||
private static void buscarCategoriaQueContemOsProdutosMaisCaros() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parabéns por essa forma de resolver a atividade, nunca tinha feito essa abordagem (ñ testei mas se funciona perfeito cara)
System.out.println(categoriaMaisCara.getKey() + " - " + categoriaMaisCara.getValue()); | ||
} | ||
|
||
private static void listarIdDosProdutosEscolhidos() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nteressante sua forma de pensar, parabéns por resolver o problema mas tem uma limitação na lógica, imagine que esses ids são informados pelo usuário... seu código não ia suportar, uma forma seria:
List<Integer> ids = Arrays.asList(850, 403, 625);
List <Produtos> produtoTempList = produtoList.stream()
.filter(p -> ids.contains(p.getId()))
.toList();
produtoIdList.forEach(System.out::println); | ||
} | ||
|
||
private static void produtoLog(Produto produto) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parabéns pelo aproveitamento de código para imprimir dados do produto uma estratégia também aceita seria fazer o @Overrride
na classe Produto
do método .toString
ex:
@Override
public String toString() {
return id + " " + nome + " " + categoria + " " + valor + " " + temEstoque + "\n";
}
No description provided.