title: Java 8 Streams filter Strings by length
body: <p>Can I use stream to check, which 2 consecutive strings have the biggest sum of their lengths?</p>
  
  <p>For example I have 5 valid usernames and I should print only <code>Johnny</code> and <code>Frank</code>:</p>
  
  <pre><code>String line = "James Jack Johnny Frank Bob";
  String regexForValidUserName = "[a-zA-Z][a-zA-Z0-9_]{2,24}";
  Pattern patternForUserName = Pattern.compile(regexForValidUserName);
  Matcher matcherForUserName = patternForUserName.matcher(line);
  List&lt;String&gt; listOfUsers = new LinkedList&lt;&gt;();
  
  if (matcherForUserName.find()) {
  listOfUsers.add(matcherForUserName.group());
  }
  
  listOfUsers.stream().map((a,b,c,d) -&gt; a.length + b.length &gt; c.length + d.length).foreach(System.out::println);
  </code></pre>