ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/Future.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/Future.java (file contents):
Revision 1.45 by dl, Fri Mar 18 16:01:42 2022 UTC vs.
Revision 1.46 by dl, Fri Apr 29 17:00:36 2022 UTC

# Line 137 | Line 137 | public interface Future<V> {
137       * Returns the computed result, without waiting.
138       *
139       * <p> This method is for cases where the caller knows that the task has
140 <     * already completed successfully, for example a filter-map of a stream of
141 <     * Future objects where the filter matches tasks that completed successfully.
140 >     * already completed successfully, for example when filtering a stream
141 >     * of Future objects for the successful tasks and using a mapping
142 >     * operation to obtain a stream of results.
143       * {@snippet lang=java :
144       *     results = futures.stream()
145       *                .filter(f -> f.state() == Future.State.SUCCESS)
# Line 153 | Line 154 | public interface Future<V> {
154       * @return the computed result
155       * @throws IllegalStateException if the task has not completed or the task
156       * did not complete with a result
157 <     * @since 99
157 >     * @since 19
158       */
159      default V resultNow() {
160          if (!isDone())
# Line 190 | Line 191 | public interface Future<V> {
191       * @return the exception thrown by the task
192       * @throws IllegalStateException if the task has not completed, the task
193       * completed normally, or the task was cancelled
194 <     * @since 99
194 >     * @since 19
195       */
196      default Throwable exceptionNow() {
197          if (!isDone())
# Line 216 | Line 217 | public interface Future<V> {
217  
218      /**
219       * Represents the computation state.
220 <     * @since 99
220 >     * @since 19
221       */
222      enum State {
223          /**
# Line 247 | Line 248 | public interface Future<V> {
248       * The default implementation uses {@code isDone()}, {@code isCancelled()},
249       * and {@code get()} to determine the state.
250       *
251 <     * @since 99
251 >     * @since 19
252       */
253      default State state() {
254          if (!isDone())
# Line 271 | Line 272 | public interface Future<V> {
272          }
273      }
274   }
274

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines