final Object maxAdvisoryByIdInternal = Collections.max(advisories, new Comparator<Object>() {
final Object maxAdvisoryByIdInternal; if (!advisories.isEmpty()) { maxAdvisoryByIdInternal = Collections.max(advisories, new Comparator<Object>() {
    private void addAdvisory(final List advisories, final Attends attends, final Interval responseWeek) throws FenixActionException {        final Object maxAdvisoryByIdInternal = Collections.max(advisories, new Comparator<Object>() {            public int compare(Object o1, Object o2) {                final Integer idInternal1 = getIdInternal(o1);                final Integer idInternal2 = getIdInternal(o2);                return idInternal1.compareTo(idInternal2);            }            private Integer getIdInternal(final Object object) {                if (object instanceof Advisory) {                    return ((Advisory) object).getIdInternal();                } else if (object instanceof AdvisoryBean) {                    return ((AdvisoryBean) object).getIdInternal();                } else {                    return null;                }            }});        final int maxId;        if (maxAdvisoryByIdInternal instanceof Advisory) {            maxId = ((Advisory) maxAdvisoryByIdInternal).getIdInternal().intValue();        } else if (maxAdvisoryByIdInternal instanceof AdvisoryBean) {            maxId = ((AdvisoryBean) maxAdvisoryByIdInternal).getIdInternal().intValue();        } else {            throw new FenixActionException("unsupported.advisory.type");        }        advisories.add(0, new AdvisoryBean(maxId + 1, attends, responseWeek));    }