Set<Guide> guides = new HashSet(); boolean toInsert = false;
List<Guide> result = new ArrayList<Guide>();
    public static List<Guide> readByYearAndState(Integer guideYear, GuideState situationOfGuide) {        Set<Guide> guides = new HashSet();        boolean toInsert = false;        for (Guide guide : RootDomainObject.getInstance().getGuides()) {            if (guideYear != null && guide.getYear().equals(guideYear)) {                toInsert = true;            }            for (GuideSituation guideSituation : guide.getGuideSituations()) {                if (guideSituation.getState().equals(State.ACTIVE)                        && guideSituation.getSituation().equals(situationOfGuide)) {                    toInsert = true;                }            }            if (toInsert) {                guides.add(guide);                toInsert = false;            }                    }        return new ArrayList(guides);    }