Date date = null, currentDate = prepareCurrentDate();
Date date = null;
    public IContract getLastContract() {        Date date = null, currentDate = prepareCurrentDate();        IContract contractToReturn = null;        for (IContract contract : this.getContracts()) {            if (contract.getEndDate() == null || contract.getEndDate().equals(currentDate)                    || contract.getEndDate().after(currentDate)) {                contractToReturn = contract;                break;            } else if (date == null || date.before(contract.getEndDate())) {                date = contract.getEndDate();                contractToReturn = contract;            }        }        return contractToReturn;    }