Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
  
  
    
    
    
    Integrator
    @FunctionalInterface interface Integrator<A : Any!, T : Any!, R : Any!>
    
    
      
        
          | Known Direct Subclasses
              
              
                
                  
                    | Gatherer.Integrator.Greedy | Greedy Integrators consume all their input, and may only relay that the downstream does not want more elements. |  | 
      
    
    An Integrator receives elements and processes them, optionally using the supplied state, and optionally sends incremental results downstream.
    Summary
    
      
        
          | Nested classes | 
        
          | abstract | Greedy Integrators consume all their input, and may only relay that the downstream does not want more elements. | 
      
    
    
      
        
          | Public methods | 
        
          | abstract Boolean | Performs an action given: the current state, the next element, and a downstream object; potentially inspecting and/or updating the state, optionally sending any number of elements downstream -- and then returns whether more elements are to be consumed or not. | 
        
          | open static Gatherer.Integrator<A, T, R>! | Factory method for turning Integrator-shaped lambdas into Integrators. | 
        
          | open static Gatherer.Integrator.Greedy<A, T, R>! | Factory method for turning Integrator-shaped lambdas into GreedyIntegrators. | 
      
    
    Public methods
    
      integrate
      
      abstract fun integrate(
    state: A, 
    element: T, 
    downstream: Gatherer.Downstream<in R>!
): Boolean
      Performs an action given: the current state, the next element, and a downstream object; potentially inspecting and/or updating the state, optionally sending any number of elements downstream -- and then returns whether more elements are to be consumed or not.
      
        
          
            | Parameters | 
          
            | state | A: The state to integrate into | 
          
            | element | T: The element to integrate | 
          
            | downstream | Gatherer.Downstream<in R>!: The downstream object of this integration | 
        
      
      
        
          
            | Return | 
          
            | Boolean | trueif subsequent integration is desired,falseif not | 
        
      
     
    
      of
      
      open static fun <A : Any!, T : Any!, R : Any!> of(integrator: Gatherer.Integrator<A, T, R>!): Gatherer.Integrator<A, T, R>!
      Factory method for turning Integrator-shaped lambdas into Integrators.
      
        
          
            | Parameters | 
          
            | integrator | Gatherer.Integrator<A, T, R>!: a lambda to create as Integrator | 
          
            | <A> | the type of state used by this integrator | 
          
            | <T> | the type of elements this integrator receives | 
          
            | <R> | the type of results this integrator can produce | 
        
      
      
     
    
      ofGreedy
      
      open static fun <A : Any!, T : Any!, R : Any!> ofGreedy(greedy: Gatherer.Integrator.Greedy<A, T, R>!): Gatherer.Integrator.Greedy<A, T, R>!
      Factory method for turning Integrator-shaped lambdas into Greedy Integrators.
      
        
          
            | Parameters | 
          
            | greedy | Gatherer.Integrator.Greedy<A, T, R>!: a lambda to create as Integrator.Greedy | 
          
            | <A> | the type of state used by this integrator | 
          
            | <T> | the type of elements this integrator receives | 
          
            | <R> | the type of results this integrator can produce | 
        
      
      
     
  
  
  
    
  
 
  
    
    
      
       
    
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-09-17 UTC.
  
  
  
    
      [null,null,["Last updated 2025-09-17 UTC."],[],[]]