src/share/classes/java/util/stream/Sink.java

Print this page
rev 7923 : 8023681: Fix raw type warning caused by Sink
Reviewed-by:


 224         @Override
 225         void accept(double value);
 226 
 227         @Override
 228         default void accept(Double i) {
 229             if (Tripwire.ENABLED)
 230                 Tripwire.trip(getClass(), "{0} calling Sink.OfDouble.accept(Double)");
 231             accept(i.doubleValue());
 232         }
 233     }
 234 
 235     /**
 236      * Abstract {@code Sink} implementation for creating chains of
 237      * sinks.  The {@code begin}, {@code end}, and
 238      * {@code cancellationRequested} methods are wired to chain to the
 239      * downstream {@code Sink}.  This implementation takes a downstream
 240      * {@code Sink} of unknown input shape and produces a {@code Sink<T>}.  The
 241      * implementation of the {@code accept()} method must call the correct
 242      * {@code accept()} method on the downstream {@code Sink}.
 243      */
 244     static abstract class ChainedReference<T> implements Sink<T> {
 245         @SuppressWarnings("rawtypes")
 246         protected final Sink downstream;
 247 
 248         public ChainedReference(Sink downstream) {
 249             this.downstream = Objects.requireNonNull(downstream);
 250         }
 251 
 252         @Override
 253         public void begin(long size) {
 254             downstream.begin(size);
 255         }
 256 
 257         @Override
 258         public void end() {
 259             downstream.end();
 260         }
 261 
 262         @Override
 263         public boolean cancellationRequested() {
 264             return downstream.cancellationRequested();
 265         }
 266     }
 267 
 268     /**
 269      * Abstract {@code Sink} implementation designed for creating chains of
 270      * sinks.  The {@code begin}, {@code end}, and
 271      * {@code cancellationRequested} methods are wired to chain to the
 272      * downstream {@code Sink}.  This implementation takes a downstream
 273      * {@code Sink} of unknown input shape and produces a {@code Sink.OfInt}.
 274      * The implementation of the {@code accept()} method must call the correct
 275      * {@code accept()} method on the downstream {@code Sink}.
 276      */
 277     static abstract class ChainedInt implements Sink.OfInt {
 278         @SuppressWarnings("rawtypes")
 279         protected final Sink downstream;
 280 
 281         public ChainedInt(Sink downstream) {
 282             this.downstream = Objects.requireNonNull(downstream);
 283         }
 284 
 285         @Override
 286         public void begin(long size) {
 287             downstream.begin(size);
 288         }
 289 
 290         @Override
 291         public void end() {
 292             downstream.end();
 293         }
 294 
 295         @Override
 296         public boolean cancellationRequested() {
 297             return downstream.cancellationRequested();
 298         }
 299     }
 300 
 301     /**
 302      * Abstract {@code Sink} implementation designed for creating chains of
 303      * sinks.  The {@code begin}, {@code end}, and
 304      * {@code cancellationRequested} methods are wired to chain to the
 305      * downstream {@code Sink}.  This implementation takes a downstream
 306      * {@code Sink} of unknown input shape and produces a {@code Sink.OfLong}.
 307      * The implementation of the {@code accept()} method must call the correct
 308      * {@code accept()} method on the downstream {@code Sink}.
 309      */
 310     static abstract class ChainedLong implements Sink.OfLong {
 311         @SuppressWarnings("rawtypes")
 312         protected final Sink downstream;
 313 
 314         public ChainedLong(Sink downstream) {
 315             this.downstream = Objects.requireNonNull(downstream);
 316         }
 317 
 318         @Override
 319         public void begin(long size) {
 320             downstream.begin(size);
 321         }
 322 
 323         @Override
 324         public void end() {
 325             downstream.end();
 326         }
 327 
 328         @Override
 329         public boolean cancellationRequested() {
 330             return downstream.cancellationRequested();
 331         }
 332     }
 333 
 334     /**
 335      * Abstract {@code Sink} implementation designed for creating chains of
 336      * sinks.  The {@code begin}, {@code end}, and
 337      * {@code cancellationRequested} methods are wired to chain to the
 338      * downstream {@code Sink}.  This implementation takes a downstream
 339      * {@code Sink} of unknown input shape and produces a {@code Sink.OfDouble}.
 340      * The implementation of the {@code accept()} method must call the correct
 341      * {@code accept()} method on the downstream {@code Sink}.
 342      */
 343     static abstract class ChainedDouble implements Sink.OfDouble {
 344         @SuppressWarnings("rawtypes")
 345         protected final Sink downstream;
 346 
 347         public ChainedDouble(Sink downstream) {
 348             this.downstream = Objects.requireNonNull(downstream);
 349         }
 350 
 351         @Override
 352         public void begin(long size) {
 353             downstream.begin(size);
 354         }
 355 
 356         @Override
 357         public void end() {
 358             downstream.end();
 359         }
 360 
 361         @Override
 362         public boolean cancellationRequested() {
 363             return downstream.cancellationRequested();
 364         }
 365     }
 366 }


 224         @Override
 225         void accept(double value);
 226 
 227         @Override
 228         default void accept(Double i) {
 229             if (Tripwire.ENABLED)
 230                 Tripwire.trip(getClass(), "{0} calling Sink.OfDouble.accept(Double)");
 231             accept(i.doubleValue());
 232         }
 233     }
 234 
 235     /**
 236      * Abstract {@code Sink} implementation for creating chains of
 237      * sinks.  The {@code begin}, {@code end}, and
 238      * {@code cancellationRequested} methods are wired to chain to the
 239      * downstream {@code Sink}.  This implementation takes a downstream
 240      * {@code Sink} of unknown input shape and produces a {@code Sink<T>}.  The
 241      * implementation of the {@code accept()} method must call the correct
 242      * {@code accept()} method on the downstream {@code Sink}.
 243      */
 244     static abstract class ChainedReference<T, E_OUT> implements Sink<T> {
 245         protected final Sink<? super E_OUT> downstream;

 246 
 247         public ChainedReference(Sink<? super E_OUT> downstream) {
 248             this.downstream = Objects.requireNonNull(downstream);
 249         }
 250 
 251         @Override
 252         public void begin(long size) {
 253             downstream.begin(size);
 254         }
 255 
 256         @Override
 257         public void end() {
 258             downstream.end();
 259         }
 260 
 261         @Override
 262         public boolean cancellationRequested() {
 263             return downstream.cancellationRequested();
 264         }
 265     }
 266 
 267     /**
 268      * Abstract {@code Sink} implementation designed for creating chains of
 269      * sinks.  The {@code begin}, {@code end}, and
 270      * {@code cancellationRequested} methods are wired to chain to the
 271      * downstream {@code Sink}.  This implementation takes a downstream
 272      * {@code Sink} of unknown input shape and produces a {@code Sink.OfInt}.
 273      * The implementation of the {@code accept()} method must call the correct
 274      * {@code accept()} method on the downstream {@code Sink}.
 275      */
 276     static abstract class ChainedInt<E_OUT> implements Sink.OfInt {
 277         protected final Sink<? super E_OUT> downstream;

 278 
 279         public ChainedInt(Sink<? super E_OUT> downstream) {
 280             this.downstream = Objects.requireNonNull(downstream);
 281         }
 282 
 283         @Override
 284         public void begin(long size) {
 285             downstream.begin(size);
 286         }
 287 
 288         @Override
 289         public void end() {
 290             downstream.end();
 291         }
 292 
 293         @Override
 294         public boolean cancellationRequested() {
 295             return downstream.cancellationRequested();
 296         }
 297     }
 298 
 299     /**
 300      * Abstract {@code Sink} implementation designed for creating chains of
 301      * sinks.  The {@code begin}, {@code end}, and
 302      * {@code cancellationRequested} methods are wired to chain to the
 303      * downstream {@code Sink}.  This implementation takes a downstream
 304      * {@code Sink} of unknown input shape and produces a {@code Sink.OfLong}.
 305      * The implementation of the {@code accept()} method must call the correct
 306      * {@code accept()} method on the downstream {@code Sink}.
 307      */
 308     static abstract class ChainedLong<E_OUT> implements Sink.OfLong {
 309         protected final Sink<? super E_OUT> downstream;

 310 
 311         public ChainedLong(Sink<? super E_OUT> downstream) {
 312             this.downstream = Objects.requireNonNull(downstream);
 313         }
 314 
 315         @Override
 316         public void begin(long size) {
 317             downstream.begin(size);
 318         }
 319 
 320         @Override
 321         public void end() {
 322             downstream.end();
 323         }
 324 
 325         @Override
 326         public boolean cancellationRequested() {
 327             return downstream.cancellationRequested();
 328         }
 329     }
 330 
 331     /**
 332      * Abstract {@code Sink} implementation designed for creating chains of
 333      * sinks.  The {@code begin}, {@code end}, and
 334      * {@code cancellationRequested} methods are wired to chain to the
 335      * downstream {@code Sink}.  This implementation takes a downstream
 336      * {@code Sink} of unknown input shape and produces a {@code Sink.OfDouble}.
 337      * The implementation of the {@code accept()} method must call the correct
 338      * {@code accept()} method on the downstream {@code Sink}.
 339      */
 340     static abstract class ChainedDouble<E_OUT> implements Sink.OfDouble {
 341         protected final Sink<? super E_OUT> downstream;

 342 
 343         public ChainedDouble(Sink<? super E_OUT> downstream) {
 344             this.downstream = Objects.requireNonNull(downstream);
 345         }
 346 
 347         @Override
 348         public void begin(long size) {
 349             downstream.begin(size);
 350         }
 351 
 352         @Override
 353         public void end() {
 354             downstream.end();
 355         }
 356 
 357         @Override
 358         public boolean cancellationRequested() {
 359             return downstream.cancellationRequested();
 360         }
 361     }
 362 }