Package org.springframework.data.domain
Class SearchResults<T>
java.lang.Object
org.springframework.data.domain.SearchResults<T>
- Type Parameters:
T- the type of content contained within eachSearchResult.
- All Implemented Interfaces:
Serializable,Iterable<SearchResult<T>>
Value object encapsulating a collection of
SearchResult instances.
Typically used as the result type for search or similarity queries, exposing access to the result content and supporting mapping operations to transform the result content type.
- Since:
- 4.0
- Author:
- Mark Paluch
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSearchResults(List<? extends SearchResult<T>> results) Creates a newSearchResultsinstance from the given list ofSearchResultitems. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturn the actual content of theSearchResultitems as an unmodifiable list.inthashCode()iterator()<U> SearchResults<U>Creates a newSearchResultsinstance with the content of the current results mapped via the givenFunction.stream()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SearchResults
Creates a newSearchResultsinstance from the given list ofSearchResultitems.- Parameters:
results- the search results to encapsulate, must not benull
-
-
Method Details
-
getContent
Return the actual content of theSearchResultitems as an unmodifiable list. -
iterator
-
stream
- Returns:
- a sequential
StreamcontainingSearchResultitems in thisSearchResultsinstance.
-
contentStream
- Returns:
- a sequential
Streamcontainingunwrapped contentitems in thisSearchResultsinstance.
-
map
Creates a newSearchResultsinstance with the content of the current results mapped via the givenFunction.- Type Parameters:
U- the target type of the mapped content.- Parameters:
converter- the mapping function to apply to the content of eachSearchResult, must not be null.- Returns:
- a new
SearchResultsinstance containing mapped result content.
-
equals
-
hashCode
public int hashCode() -
toString
-