reaproveitamento-poo-java

commit b591a0b16da2902bdd02b40a1740600981b7c3a7

Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>

main: list real state units by their desc revenue forecast estimate

 src/org/porcellis/Main.java | 4 ++++
 src/org/porcellis/controllers/ImobiliariaController.java | 9 +++++++++


diff --git a/src/org/porcellis/Main.java b/src/org/porcellis/Main.java
index 29e5f88d63610407e93e3d5c8c7ada8766203c34..bedf694d7ede6eb34fc74d4a289cdd7120d8b04d 100644
--- a/src/org/porcellis/Main.java
+++ b/src/org/porcellis/Main.java
@@ -137,6 +137,10 @@ 		System.out.println("\n\tListar imoveis por preco de cotação:\n");
 
 		imovelController.listarPorPrecoCotacao();
 
+		System.out.println("\n\tListar unidades por previsao de faturamento:\n");
+
+		imobiliariaController.listarPorPrevisaoFaturamento();
+
 		System.out.println("\nXau!");
 	}
 




diff --git a/src/org/porcellis/controllers/ImobiliariaController.java b/src/org/porcellis/controllers/ImobiliariaController.java
index 7bc66e3d7c0084adc9b6f4c843fc8720f754098f..43c5fc2aa8ac7def20ebd74e74b71cef7b8228f7 100644
--- a/src/org/porcellis/controllers/ImobiliariaController.java
+++ b/src/org/porcellis/controllers/ImobiliariaController.java
@@ -6,6 +6,7 @@ import org.porcellis.views.ImobiliariaView;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Comparator;
 
 public class ImobiliariaController {
 	private ImobiliariaView imobiliariaView;
@@ -30,6 +31,14 @@ 	public void exibirPrevisaoITBI() {
 		for (Imobiliaria unidade : imobiliarias) {
 			imobiliariaView.mostrarPrevisaoITBI(unidade);
 		}
+	}
+
+	public void listarPorPrevisaoFaturamento() {
+		imobiliarias.stream()
+			.sorted(Comparator.comparingDouble(Imobiliaria::getPrevisaoDeFaturamento).reversed())
+			.forEach(imobiliaria -> {
+				imobiliariaView.mostrarPrevisaoFaturamento(imobiliaria);
+			});
 	}
 
 	public void listarImobiliarias() {