private IChartValueInvestigation[] getInvestigationComments(IChartValueSet value) { ArrayList<IChartValueInvestigation> investigations = new ArrayList<IChartValueInvestigation>(); IChartValueGroup[] groups = value.getIChartValueSetGroups(); if (groups != null && groups.length > 0) { for (int i = 0; i < groups.length; i++) { IChartValue[] analytes = groups[i].getIChartValueGroupValues(); if (analytes != null && analytes.length > 0) { for (int j = 0; j < analytes.length; j++) { IChartValueInvestigation investigation = analytes[j].getIChartValueInvestigation(); if (investigation != null && investigation.getIChartValueComments() != null && investigation.getIChartValueComments().length > 0) { // Check if investigation is already added (have to do this mannualy as equals method fails for interfaces) if (!isAdded(investigations, investigation)) { investigations.add((ChartInvestigationCommentsVo)investigation); } } } } } } Collections.sort(investigations, new InvestigationsComparator()); return investigations.toArray(new IChartValueInvestigation[investigations.size()]); }