@Override public <T extends CatalogInfo> CloseableIterator<T> list( final Class<T> of, final Filter filter, @Nullable Integer offset, @Nullable Integer count, @Nullable SortBy... sortOrder) { if (sortOrder != null) { for (SortBy so : sortOrder) { if (sortOrder != null && !canSort(of, so.getPropertyName().getPropertyName())) { throw new IllegalArgumentException( "Can't sort objects of type " + of.getName() + " by " + so.getPropertyName()); } } } Iterable<T> iterable = iterable(of, filter, sortOrder); if (offset != null && offset.intValue() > 0) { iterable = Iterables.skip(iterable, offset.intValue()); } if (count != null && count.intValue() >= 0) { iterable = Iterables.limit(iterable, count.intValue()); } Iterator<T> iterator = iterable.iterator(); return new CloseableIteratorAdapter<T>(iterator); }