return list.get(list.size() - 1).getLessonHours();
return (list.get(list.size() - 1).getLessonHours() == null) ? 0 : list.get(list.size() - 1) .getLessonHours();
    public int getHoursByCategory(Date begin, Date end) {                        List<TeacherLegalRegimen> list = getAllLegalRegimensBelongsToPeriod(begin, end);                         if (list.isEmpty()) {            return 0;        } else {            Collections.sort(list, new BeanComparator("beginDate"));            return list.get(list.size() - 1).getLessonHours();        }    }