class QuestionGroupFilterForLoan implements QuestionGroupFilter {

    @Override
    public <T> List<T> doFilter(List<T> t, Criteria<T> criteria) {
        if (t == null || loanOfferingBO == null) return t;
        List<T> filteredResult = new ArrayList<T>();
        Set<QuestionGroupReference> questionGroupReferences = loanOfferingBO.getQuestionGroups();
        if (questionGroupReferences != null) {
            for (QuestionGroupReference questionGroupReference : questionGroupReferences) {
                T result = criteria.filter(questionGroupReference.getQuestionGroupId(), t);
                if (result != null) filteredResult.add(result);
            }
        }
        return filteredResult;
    }

}