1
There would be ways to transform the following code to java 8 Stream?
setores = new SetorBusiness().buscarEtiquetaFuncionario(null, codDiretoriaSelecionada, codCoordSelecionada, uf, cidade, servidor, null, null, agencia);
parametrosRelatorio = new ParametrosRelatorio("QtdUorgFunc", SaidaRelatorioEnum.buscaEnum(tipo));
parametrosRelatorio.getParams().put("sub", FacesContext.getCurrentInstance().getExternalContext().getRealPath("/relatorios/SubQtdUorgFunc"));
if (!setores.isEmpty()) {
List<Setor> listaSetores = new ArrayList<Setor>();
Setor set;
Map<String, List<Setor>> lista = new LinkedHashMap<String, List<Setor>>();
for (Setor s : setores) {
if (lista.containsKey(s.getSiglaSetor())) {
lista.get(s.getSiglaSetor()).add(s);
} else {
List<Setor> se = new ArrayList<Setor>();
se.add(s);
lista.put(s.getSiglaSetor(), se);
}
}
for (List<Setor> l : lista.values()) {
set = new Setor();
set.setSiglaSetor(l.get(0).getSiglaSetor());
set.setCodigo(l.get(0).getCodigo());
set.getSetorImpressaoPDF().addAll(l);
listaSetores.add(set);
}
Util.gerarRelatorio(listaSetores, parametrosRelatorio);
A
Setor
may have several other sectors within thesetorImpressaoPDF
? This is strange. If the father sector and the children sector are different things, the situation becomes simpler.– Victor Stafusa
That’s right.Victor A Sector can have several other sectors within the industry. at the end I am grouped with the code and siglasetor and a list . It is precisely for report.
– user2509556