Package 

Class Tube

  • All Implemented Interfaces:
    kotlinx.coroutines.flow.Flow , kotlinx.coroutines.flow.FlowCollector

    
    public final class Tube<T extends Object>
     implements Flow<T>, FlowCollector<T>
                        

    A synchronous data stream that emits values and completes normally.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Tube()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Unit collect(FlowCollector<T> collector) Adds the given collector into collectors and suspends until cancellation.
      Unit emit(T value) Emits a value to the collectors, suspending until the value is fully consumed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Tube

        Tube()
    • Method Detail

      • collect

         Unit collect(FlowCollector<T> collector)

        Adds the given collector into collectors and suspends until cancellation.

        This method is thread-safe and can be safely invoked from concurrent coroutines without external synchronization.

      • emit

         Unit emit(T value)

        Emits a value to the collectors, suspending until the value is fully consumed.

        This method is thread-safe and can be safely invoked from concurrent coroutines without external synchronization.