title: How to compare string characters using stream?
body: <p>I studying the stream, I encountered a question. I have a List  I need to sort by the length of the string, all the strings where there is a match of uppercase characters, if there are no such, then sort by alphabet.</p>
  
  <pre><code>List&lt;String&gt; phones = new ArrayList&lt;&gt;();
  Collections.addAll(phones, "iPhone X", "Nokia 9", "Huawei Nexus 6P",
          "Samsung Galaxy S8", "LG G6", "Xiaomi MI6", "Sony Xperia Z5",
          "Asus Zenfone 3", "Meizu Pro 6", "Heizu Pro 6",
          "pixel 2");
  
  phones.stream().filter(s -&gt; s.matches("A-Z")).sorted(Comparator.comparingInt(String::length)).forEach(System.out::println);
  </code></pre>
  
  <p>I try to use matches, but I make a mistake somewhere, since nothing is output. How can I fix this?</p>