Package se.l4.silo

Interface FetchResult<T>

    • Method Detail

      • getSize

        long getSize()
        Get the number of returned results.
        Returns:
      • getOffset

        long getOffset()
        Get the offset used to fetch these results.
        Returns:
      • getLimit

        long getLimit()
        Get the limit used to fetch these results.
        Returns:
      • getTotal

        long getTotal()
        Get the total number of results available.
        Returns:
      • isEmpty

        boolean isEmpty()
        Check if these results are empty.
        Returns:
      • first

        default Optional<T> first()
        Get the first entry is this result.
        Returns:
      • transform

        default <N> FetchResult<N> transform​(Function<T,​N> func)
        Transform this fetch result using the given function.
        Parameters:
        func -
        Returns:
      • stream

        default Stream<T> stream()
        Get a Stream for this result, see Collection.stream() for details. The returned stream will close this result when it itself is closed.
        Returns:
      • parallelStream

        default Stream<T> parallelStream()
        Get a Stream for this result for parallel operations, see Collection.parallelStream() for details. The returned stream will close this result when it itself is closed.
        Returns:
      • empty

        static <N> FetchResult<N> empty()
        Get an empty fetch result.
        Returns:
      • single

        static <N> FetchResult<N> single​(N data)
        Get a FetchResult representing the fetch of a single item.
        Parameters:
        data -
        Returns:
      • forCollection

        static <N> FetchResult<N> forCollection​(Collection<N> collection)
        Get a FetchResult for the given collection. This will assume that the offset and limit used to fetch this was zero.
        Parameters:
        collection -
        Returns:
      • forCollection

        static <N> FetchResult<N> forCollection​(Collection<N> collection,
                                                int offset,
                                                int limit,
                                                int hits)
        Get a FetchResult for the given collection. This will assume that the offset and limit used to fetch this was zero.
        Parameters:
        collection -
        Returns: