title: How to reuse a method with different arguments without duplicating code
body: <p>Sonar is complaining about this method which is duplicated code (The same exact method is available in two different Mapper classes)</p>
  <p><strong>EventBasicMapper:</strong></p>
  <pre><code>private Optional&lt;Date&gt; getDoneDate(EventTable event) {
      var eventStatus = event.getEventStatus();
  
      if(eventStatus.getName().equals(EventState.DONE.getName())) {
          List&lt;EventStatusLog&gt; eventStatusLogs = event.getEventStatusLog();
          if(eventStatusLogs.isEmpty()) {
              return Optional.of(Iterables.getLast(event.getLogs()).getDate());
          }
          return Optional.of(Iterables.getLast(eventStatusLogs).getModified());
      } else {
          return Optional.empty();
      }
  }
  </code></pre>
  <p><strong>EventMapper</strong></p>
  <pre><code>private Optional&lt;Date&gt; getDoneDate(Event event) {
      var eventStatus = event.getEventStatus();
  
      if(eventStatus.getName().equals(EventState.DONE.getName())) {
          List&lt;EventStatusLog&gt; eventStatusLogs = event.getEventStatusLog();
          if(eventStatusLogs.isEmpty()) {
              return Optional.of(Iterables.getLast(event.getLogs()).getDate());
          }
          return Optional.of(Iterables.getLast(eventStatusLogs).getModified());
      } else {
          return Optional.empty();
      }
  }
  </code></pre>
  <p>The only difference between these methods is the argument: one receives an EventTable and the other receives an Event.
  Is there a way i can reuse this functionality without duplicating the code? Is there any way i can call this method and pass a different data type paramether?</p>
  <p>Hopefully i explained my issue here. Thanks!</p>