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 newSearchResults
instance from the given list ofSearchResult
items. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Return the actual content of theSearchResult
items as an unmodifiable list.int
hashCode()
iterator()
<U> SearchResults<U>
Creates a newSearchResults
instance 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, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SearchResults
Creates a newSearchResults
instance from the given list ofSearchResult
items.- Parameters:
results
- the search results to encapsulate, must not benull
-
-
Method Details
-
getContent
Return the actual content of theSearchResult
items as an unmodifiable list. -
iterator
-
stream
- Returns:
- a sequential
Stream
containingSearchResult
items in thisSearchResults
instance.
-
contentStream
- Returns:
- a sequential
Stream
containingunwrapped content
items in thisSearchResults
instance.
-
map
Creates a newSearchResults
instance 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
SearchResults
instance containing mapped result content.
-
equals
-
hashCode
public int hashCode() -
toString
-