public Iterator < ? > getElements ( Filter filter , int offset , int maxResultSize ) throws LayerException { if ( null == filter ) { filter = Filter . INCLUDE ; } List < Object > filteredList = new ArrayList < Object > ( ) ; try { synchronized ( featuresById ) { for ( Object feature : featuresById . values ( ) ) { if ( filter . evaluate ( feature ) ) { filteredList . add ( feature ) ; } } } } catch ( Exception e ) { // NOSONAR throw new LayerException ( e , ExceptionCode . FILTER_EVALUATION_PROBLEM , filter , getId ( ) ) ; } // Sorting of elements. if ( comparator != null ) { Collections . sort ( filteredList , comparator ) ; } if ( maxResultSize > 0 ) { int fromIndex = Math . max ( 0 , offset ) ; int toIndex = Math . min ( offset + maxResultSize , filteredList . size ( ) ) ; toIndex = Math . max ( fromIndex , toIndex ) ; return filteredList . subList ( fromIndex , toIndex ) . iterator ( ) ; } else { return filteredList . iterator ( ) ; } }
This implementation does not support the offset and maxResultSize parameters .