title: Intellij warning: Return value of the method is never used
body: <p>I have some code that seems OK, but Intellij IDEA warns about many of its methods that <code>return</code> values that</p>
  <blockquote>
  <p>Return value of the method is never used</p>
  </blockquote>
  <hr />
  <p>Here is the actual code below, a builder class.</p>
  <pre><code>public static class StreamParserBuilder{
      //optional - have defaults:
      private long spanLimit1 = 2000L;
      private long spanLimit2 = 100000L;
      private long spanLimit3 = 3000000L;
      private String[] coordinates = {&quot;L1&quot;, &quot;R2&quot;};
      private String outputDirectory = System.getProperty(&quot;user.dir&quot;);
      private boolean isLastSteam = false;
  
      //required from the builder.
      private String[] args;
      private String inputFile;
      private String streamData;
      private boolean isPaired;
  
      public StreamParserBuilder(String[] args, String inputFile, String streamData, boolean isPaired){
          this.args = args;
          this.inputFile = inputFile;
          this.streamData = streamData;
          this.isPaired = isPaired;
      }
  
      public StreamParserBuilder withSpanLimit1(long spanLimit1){
          this.spanLimit1 = spanLimit1;
          return this;
      }
  
      public StreamParserBuilder withSpanLimit2(long spanLimit2){
          this.spanLimit2 = spanLimit2;
          return this;
      }
  
      public StreamParserBuilder withSpanLimit3(long spanLimit3){
          this.spanLimit3 = spanLimit3;
          return this;
      }
  
      public StreamParserBuilder withCoordinates(String[] coordinates){
          this.coordinates = coordinates;
          return this;
      }
  
      public StreamParserBuilder withOutputDirectory(String outputDirectory){
          this.outputDirectory = outputDirectory;
          return this;
      }
  
      public StreamParserBuilder isLastStream(boolean isLastSteam){
          this.isLastSteam = isLastSteam;
          return this;
      }
  
      public StreamParser build(){
          return new StreamParser(this);
      }
  </code></pre>
  <p>Is there an issue with the code, maybe i've instantiated the .build() method incorrectly? The code for my StreamParser constructor:</p>
  <pre><code>private StreamParser(StreamParserBuilder streamParserBuilder){
      this.args = streamParserBuilder.args;
      this.inputFile = streamParserBuilder.inputFile;
      this.streamData = streamParserBuilder.streamData;
      this.spanLimit1 = streamParserBuilder.spanLimit1;
      this.spanLimit2 = streamParserBuilder.spanLimit2;
      this.spanLimit3 = streamParserBuilder.spanLimit3;
      this.coordinates = streamParserBuilder.coordinates;
      this.outputDirectory = streamParserBuilder.outputDirectory;
      this.isLastStream = streamParserBuilder.isLastSteam;
      this.isPaired = streamParserBuilder.isPaired;
  }
  </code></pre>
  <p>Is there a better way to implement this? If the code is okay, what causes this warning?</p>
  <p>Edit: Usage of the StreamParserBuilder, calling the withX functions:</p>
  <pre><code> StreamParserBuilder streamBuilder = new StreamParserBuilder(args, inputFile, stream, isPaired);
          if (isSpanOneReplaced) streamBuilder.withSpanLimit1(spanLimit1);
          if (isSpanTwoReplaced) streamBuilder.withSpanLimit2(spanLimit2);
          if (isSpanThreeReplaced) streamBuilder.withSpanLimit3(spanLimit3);
          if (areCoordinatesReplaced) streamBuilder.withCoordinates(coordinates);
          if (isOutputDirectoryReplaced) streamBuilder.withOutputDirectory(outputDirectory);
          if (streamCount == streamData.size()) streamBuilder.isLastStream(true);
          StreamParser streamParser = streamBuilder.build();
  </code></pre>