Enumeration equip = en.getEquipment(); while (equip.hasMoreElements()) { Mounted m = (Mounted)equip.nextElement(); if (m.getType() instanceof MiscType &&
for (Mounted m : en.getEquipment()) { if (m.getType() instanceof MiscType &&
    public Mounted getSelectedEquipment() {        if (en instanceof Tank) {            if (en.hasTargComp()) {                Enumeration equip = en.getEquipment();                while (equip.hasMoreElements()) {                    Mounted m = (Mounted)equip.nextElement();                    if (m.getType() instanceof MiscType &&                         m.getType().hasFlag(MiscType.F_TARGCOMP) ) {                        return m;                    }                }            }        }        final CriticalSlot cs = getSelectedCritical();        if (null == cs) {            return null;        }        if (cs.getType() == CriticalSlot.TYPE_SYSTEM) {            return null;        }        return en.getEquipment (cs.getIndex());    }