title: sonarLint: make this anonymous inner class a lambda
body: <p>Below code has a notification from SonarLint:</p>
  
  <pre><code>handler.setFileNameGenerator((new FileNameGenerator() {
      @Override
      public String generateFileName(Message&lt;?&gt; message) {
          if (message.getPayload() instanceof File) {
              return ((File) message.getPayload()).getName();
          } else {
              throw new IllegalArgumentException("File expected as payload.");
          }
      }
  }));
  </code></pre>
  
  <p>I was trying the below but having issues with the <code>throw new IllegalArgumentException</code> piece:</p>
  
  <pre><code>handler.setFileNameGenerator(message -&gt; 
         (message.getPayload() instanceof File) ? 
         ((File) message.getPayload()).getName() : 
         throw new IllegalArgumentException("File expected as payload."));
  </code></pre>
  
  <p>Can you please advise?</p>