title: pass a method as a parameter in Java 8?
body: <p>I have the method <code>send</code> below, the method pass a method <code>eventService.send(request)</code> as parameter.
  I don't like it to be written as is, since the  <code>eventService.send(request)</code> is the main functionality in the code. 
  I am wondering is there an inelegant way to pass the method as parameter or the other option is to extract it to an object :</p>
  
  <p>One option :    </p>
  
  <pre><code>     public Response send(EventServiceRequest request){
         ResponseEntity&lt;ServiceResponse&gt; responseEntity;
  
         responseEntity = handleResponse(eventService.send(request),request);
       return Response.status(responseEntity.getStatusCode().value()).entity(responseEntity.getBody()).build();
       }
  </code></pre>
  
  <p>Second option :    </p>
  
  <pre><code>     public Response send(EventServiceRequest request){
         ResponseEntity&lt;ServiceResponse&gt; responseEntity;
         EventServiceResponse resp = eventService.send(request);
         responseEntity = handleResponse(resp,request);
       return Response.status(responseEntity.getStatusCode().value()).entity(responseEntity.getBody()).build();
       }
  </code></pre>
  
  <pre><code>     private ResponseEntity&lt;EventServiceResponse&gt; handleResponse(EventServiceResponse response, EventServiceRequest request) {
          return handleResponse(response, request, null, null);
      }
  </code></pre>