List retorno = new ArrayList();
Iterator itS = segmentos.iterator();
while(itS.hasNext()){
SegmentoSgt segmento = (SegmentoSgt) itS.next();
SegmentoAgendaBean segAgd = new SegmentoAgendaBean();
segAgd.setAgenda(false);
segAgd.setSegmento(true);
segAgd.setDescricao(segmento.getTituloSgt());
segAgd.setCodigo(segmento.getCodSgt());
retorno.add(segAgd);
}
List agendas = new AgendaDao(request).getAtivos();
Iterator itA = agendas.iterator();
while(itA.hasNext()){
AgendaAge agenda = (AgendaAge) itA.next();
SegmentoAgendaBean segAgd = new SegmentoAgendaBean();
segAgd.setAgenda(true);
segAgd.setSegmento(false);
segAgd.setDescricao(agenda.getEventoAge());
segAgd.setCodigo(agenda.getCodAge());
retorno.add(segAgd);
}
Collections.sort(retorno,
new Comparator() {
public int compare(Object o1, Object o2) {
SegmentoAgendaBean sa1 = (SegmentoAgendaBean) o1;
SegmentoAgendaBean sa2 = (SegmentoAgendaBean) o2;
return sa1.getDescricao().compareToIgnoreCase(sa2.getDescricao());
}
} );
return retorno;
}