@@ -68,6 +68,7 @@ public static <T> T singleResult(@Nullable Collection<T> results) throws Incorre
6868 * @return the single result object, or {@code null} if none
6969 * @throws IncorrectResultSizeDataAccessException if more than one
7070 * element has been found in the given Stream
71+ * @since 6.1
7172 */
7273 @ Nullable
7374 public static <T > T singleResult (@ Nullable Stream <T > results ) throws IncorrectResultSizeDataAccessException {
@@ -91,13 +92,14 @@ public static <T> T singleResult(@Nullable Stream<T> results) throws IncorrectRe
9192 * @return the single result object, or {@code null} if none
9293 * @throws IncorrectResultSizeDataAccessException if more than one
9394 * element has been found in the given Iterator
95+ * @since 6.1
9496 */
9597 @ Nullable
9698 public static <T > T singleResult (@ Nullable Iterator <T > results ) throws IncorrectResultSizeDataAccessException {
9799 if (results == null ) {
98100 return null ;
99101 }
100- T result = results .hasNext () ? results .next () : null ;
102+ T result = ( results .hasNext () ? results .next () : null ) ;
101103 if (results .hasNext ()) {
102104 throw new IncorrectResultSizeDataAccessException (1 );
103105 }
@@ -112,6 +114,7 @@ public static <T> T singleResult(@Nullable Iterator<T> results) throws Incorrect
112114 * @return the single optional result object, or {@code Optional.empty()} if none
113115 * @throws IncorrectResultSizeDataAccessException if more than one
114116 * element has been found in the given Collection
117+ * @since 6.1
115118 */
116119 public static <T > Optional <T > optionalResult (@ Nullable Collection <T > results ) throws IncorrectResultSizeDataAccessException {
117120 return Optional .ofNullable (singleResult (results ));
@@ -125,6 +128,7 @@ public static <T> Optional<T> optionalResult(@Nullable Collection<T> results) th
125128 * @return the single optional result object, or {@code Optional.empty()} if none
126129 * @throws IncorrectResultSizeDataAccessException if more than one
127130 * element has been found in the given Stream
131+ * @since 6.1
128132 */
129133 public static <T > Optional <T > optionalResult (@ Nullable Stream <T > results ) throws IncorrectResultSizeDataAccessException {
130134 return Optional .ofNullable (singleResult (results ));
@@ -138,6 +142,7 @@ public static <T> Optional<T> optionalResult(@Nullable Stream<T> results) throws
138142 * @return the single optional result object, or {@code Optional.empty()} if none
139143 * @throws IncorrectResultSizeDataAccessException if more than one
140144 * element has been found in the given Iterator
145+ * @since 6.1
141146 */
142147 public static <T > Optional <T > optionalResult (@ Nullable Iterator <T > results ) throws IncorrectResultSizeDataAccessException {
143148 return Optional .ofNullable (singleResult (results ));
0 commit comments