2
//Metodo para crear un nuevo control de franquicia
public void crearControl(ArrayList<Franquicia> listaFranquicias, ArrayList<Inspector> listaInspectores) {
    if (!objSistema.getListaFranquicias().isEmpty()){
        if(!objSistema.getListaInspectores().isEmpty()){

        //Inicializacion de variables
        Inspector miInspector = new Inspector();
        Franquicia miFranquicia = new Franquicia();
        int mes = 0;
        String controlSupCon = "No";
        int controlCantContSup = 0;

        //Franquicia
        miFranquicia = (Franquicia) seleccionarObjetoF("================================================"
                + "\nSeleccione la franquicia: ", listaFranquicias);

        //Mes
        mes = pedirNumero("Ingrese un mes: ", 1, 12);

        //Indicadores
        asignarArrayInd(objSistema.getListaNombreInd(), objSistema.getListaIndicadores());

        //Supero control
        if (superoControl(objSistema.getListaIndicadores())) {
            controlSupCon = "Si";
            controlCantContSup++;
        }

        //Inspector
        miInspector = (Inspector) seleccionarObjetoI("================================================"
                + "\nSeleccione el inspector que realizo el control: ", listaInspectores);

        //Mensaje de confirmacion
        System.out.println("Los datos del control fueron ingresados con exito."
                + "\n================================================");

        Control nuevoControl = new Control(miFranquicia, miInspector, mes, controlSupCon, controlCantContSup);

        if (esIgualMes(objSistema.getListaControles(), nuevoControl)) {
            reemplazarControl(objSistema.getListaControles(), nuevoControl);
        } else {
            objSistema.getListaControles().add(nuevoControl);
        }

    } else {
        System.out.println("No hay inspectores ingresados.");
    }
    }else{
        System.out.println("No hay franquicias ingresados");
    }
}

Please, help me here. I need to show both system out messages when the user hits this option when both ArrayList "listaFranquicias" and "listaInspectores" are empty. Right now, it only shows the first system out, and i want to show both. Thank you.

1 Answers1

0

You need to duplicate the first sysout right above the second one in the last branch of code if you want them both. But please do so only if the emptiness of the first (outer) list is always in conjunction with the emptiness of the second (inner) list. Otherwise you will have a bug.

diginoise
  • 7,352
  • 2
  • 31
  • 39