class PlaylistEntryRepository {

    private static final String QUERY_FIND_ALL_PLAYLIST_ENTRIES =
            "SELECT p.PlaylistId as 'playlistID', " +
            "       p.Name as 'playlistName', " +
            "       t.Name as 'trackName', " +
            "       ar.Name as 'artistName', " +
            "       a.title as 'albumTitle' " +
            "FROM playlist p, PlaylistTrack pt, track t, Album a, Artist ar " +
            "WHERE p.PlaylistId = pt.PlaylistId AND " +
            "      pt.TrackId = t.TrackId AND " +
            "      t.AlbumId = a.AlbumId AND " +
            "      a.ArtistId = ar.ArtistId";


    private JdbcTemplate jdbcTemplate;


    public PlaylistEntryRepository() {
        super();
    }


    @Autowired
    public void setJdbcTemplate(final JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }


    public Iterator<PlaylistEntry> findAllPlaylistEntries() {

        return this.jdbcTemplate.query(
                QUERY_FIND_ALL_PLAYLIST_ENTRIES,
                (resultSet, i) -> {
                    return new PlaylistEntry(
                            Integer.valueOf(resultSet.getInt("playlistID")),
                            resultSet.getString("playlistName"),
                            resultSet.getString("trackName"),
                            resultSet.getString("artistName"),
                            resultSet.getString("albumTitle"));
                }).iterator();

    }


    public Iterator<PlaylistEntry> findLargeCollectionPlaylistEntries() {

        final List<PlaylistEntry> baseList =
                this.jdbcTemplate.query(
                    QUERY_FIND_ALL_PLAYLIST_ENTRIES,
                    (resultSet, i) -> {
                        return new PlaylistEntry(
                                Integer.valueOf(resultSet.getInt("playlistID")),
                                resultSet.getString("playlistName"),
                                resultSet.getString("trackName"),
                                resultSet.getString("artistName"),
                                resultSet.getString("albumTitle"));
                    });

        return new Iterator<PlaylistEntry>() {

            private static final int REPEATS = 300;

            private int repeatCount = 0;
            private Iterator<PlaylistEntry> currentIterator = null;

            @Override
            public boolean hasNext() {<FILL_FUNCTION_BODY>}

            @Override
            public PlaylistEntry next() {
                return this.currentIterator.next();
            }

        };

    }

}

                if (this.currentIterator != null && this.currentIterator.hasNext()) {
                    return true;
                }
                if (this.repeatCount < REPEATS) {
                    this.currentIterator = baseList.iterator();
                    this.repeatCount++;
                    return true;
                }
                return false;
            
<no_super_class>