title: Call Higher Order function of Kotlin from Java
body: <p><strong>Kotin Class</strong></p>
  
  <pre><code>class LoginService{
  
      fun getLoginData(loginData: String) {
          request(LoginApi.create().getLoginData(loginData))}
      }
  
      fun changePassword(_:String){
          request(LoginApi.create().changePassword(_)
      }
  
      class RequestData {
          var retrofitCall: ((String) -&gt; Unit)? = null
      }
  }
  </code></pre>
  
  <p><strong>Java Class</strong></p>
  
  <pre><code>class LoginModel{
  
      private void loginData(){
          RequestData data = new RequestData();
          requestData.setRetrofitCall(username -&gt;LoginService::getLoginData)
      }
  
      private void changePassword(){
          RequestData data = new RequestData();
          requestData.setRetrofitCall(username -&gt;LoginService::changePassword)
       }
   }
  </code></pre>
  
  <p><strong>requestData.setRetrofitCall(username ->LoginService::changePassword)</strong></p>
  
  <p><strong>Why Higher order function</strong> : </p>
  
  <p>Since i have to differentiate between each API call for calling a function from its feature hence trying to use.</p>
  
  <p>How to call the above highlighted code?</p>