title: Kotlin function type mismatch
body: <blockquote>
  <p>I create two function one is sleepExecution and getCustomers I try to
  use sleepExecution  in getCustomer function . I get below compile time
  error</p>
  </blockquote>
  <pre><code>Type mismatch.
  Required:
  ((Int) → Unit)!
  Found:
  KFunction2&lt;CustomerDao, Int, Unit&gt;
  </code></pre>
  <blockquote>
  <p>CustomerDao.kt</p>
  </blockquote>
  <pre><code>package com.main.stockprice.model
  
  import com.main.stockprice.dto.Customer
  import org.springframework.stereotype.Component
  import java.util.stream.Collectors
  import java.util.stream.IntStream
  
  
  @Component
  class CustomerDao {
      fun sleepExecution(i: Int){
          try {
              Thread.sleep(1000)
          }catch (e:InterruptedException){
              e.printStackTrace()
          }
      }
      fun getCustomer():List&lt;Customer?&gt;?{
          return IntStream.rangeClosed(1,10)
              .peek(CustomerDao::sleepExecution)
              .peek { i : Int -&gt; println(&quot;processing count : $i&quot;) }
              .mapToObj { i: Int -&gt; Customer(i.toLong(),&quot;customer$i&quot;) }
              .collect(Collectors.toList())
      }
  
  }
  </code></pre>
  <blockquote>
  <p>Customer.kt</p>
  </blockquote>
  <pre><code>package com.main.stockprice.dto
  
  data class Customer(
      val id: Long = 0,
      val name: String?= null,
  )
  </code></pre>
  <blockquote>
  <p>i get err or exact this point</p>
  </blockquote>
  <pre><code>.peek(CustomerDao::sleepExecution)
  </code></pre>