001/*
002 * (C) Copyright 2020 Nuxeo (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 *
016 *  Contributors:
017 *      Kevin Leturc <kleturc@nuxeo.com>
018 */
019
020package org.nuxeo.ecm.core.scroll;
021
022import java.util.List;
023import java.util.Map;
024import java.util.NoSuchElementException;
025
026import org.nuxeo.ecm.core.api.scroll.Scroll;
027import org.nuxeo.ecm.core.api.scroll.ScrollRequest;
028
029/**
030 * Executes the scroll on an empty result set, useful for external scrollers.
031 *
032 * @since 11.3
033 */
034public class EmptyScroll implements Scroll {
035
036    @Override
037    public void init(ScrollRequest request, Map<String, String> options) {
038        // nothing
039    }
040
041    @Override
042    public void close() {
043        // nothing
044    }
045
046    @Override
047    public boolean hasNext() {
048        return false;
049    }
050
051    @Override
052    public List<String> next() {
053        throw new NoSuchElementException();
054    }
055}