title: How to get words average length using Lambda Expression
body: <p>I have a word list text file, I want to get min, max and average word lengths from that file.</p>
  
  <p>I have a stream method:</p>
  
  <pre><code>public static Stream&lt;String&gt; readWords(String filename) {
      try {
          BufferedReader reader = new BufferedReader(new FileReader(filename));
          Stream&lt;String&gt; stringStream = reader.lines();
          return stringStream;
      } catch (IOException exn) {
          return Stream.&lt;String&gt;empty();
      }
  }
  </code></pre>
  
  <p>In my main method for testing I'm printing max and min</p>
  
  <pre><code>System.out.println(readWords(filename)
          .min(Comparator.comparing(s -&gt; s.length()))
          .get()
          .length()
  );
  System.out.println(readWords(filename)
          .max(Comparator.comparing(s -&gt; s.length()))
          .get()
          .length()
  );
  </code></pre>
  
  <p>it works as expected.</p>
  
  <p><strong>Questions:</strong> <br />
  Is it possible to get the average of the word length like I did in min and max? In both case yes or no, how to do that (only as Lambda Expression)?</p>