}
public Iterator iterator(int first, int count)
{
List list = getList();
final SortParam sortParam = getSort();
if (sortParam != null) {
if (list != listModel.getObject() || // Synthesized list. Always sort.
lastSortParam == null || // Haven't sorted yet.
!lastSortParam.getProperty().equals(sortParam.getProperty()) || // Sort params changed.
lastSortParam.isAscending() != sortParam.isAscending()) {
lastSortParam = new SortParam(sortParam.getProperty(), sortParam.isAscending());
ElementMetaData property = metaData.findElement(sortParam.getProperty());
Collections.sort(list, new PropertyComparator(property, sortParam.isAscending()));
}
}
return list.subList(first, first + count).iterator();
}