title: javax.swing.UIManager.getIcon(Object key) returns null when String-keys are streamed from an ArrayList
body: <p><strong>What I want to achieve:</strong>
  I want to visualize some <code>javax.swing.Icon</code>s from the <code>javax.swing.UIManager</code>. On the internet I've found a list of <code>UIManager</code>-keys, which will not only return <code>Icons</code> but also <code>Strings</code>, <code>Colors</code> and so on. So in this step I want to filter the list of keys so only the <code>Icon</code>-keys remain.</p>
  
  <p><strong>My Approach:</strong>
  I copied a list of <code>UIManager</code> keys into a textfile and included it as recource in my Java-Project. I successfully read the file so I split the file-content by lines and added them to an <code>ArrayList</code> of <code>Strings</code>. Now i wanted to stream the content of this <code>ArrayList</code> and filter the keys by wether the <code>UIManager.getIcon(Object key)</code>-Method returns <code>null</code> or not...</p>
  
  <p><strong>My Problem</strong>
  so far: the <code>UIManager</code> always returns <code>null</code>. I printed all the keys and the <code>UIManager</code> result to the console (<em>see "Output / Test - stream keys" in my code</em>). If i manually copy a key from the console (one that I know should work) and paste it into the exact same piece of code, it actually works (<em>see "Output / Test - single Key" in my code</em>).</p>
  
  <p><strong>Interesting Behavior</strong> shows when I append a <code>String</code> to the key that I want to print to the console (<em>See the variable "suffix" under "Output / Test - stream Keys" in my code</em>). If the variable <code>suffix</code> does not start with "\n", the following print-Method in the stream will only print the <code>suffix</code> and no longer show the other content. For example if I type <code>String suffix = "test";</code> only "test" will be printed from the <code>.forEach(key-&gt;System.out.println(... + key + suffix);</code> However, this behavior does not show up in the "Output / Test - single Key"-Example.</p>
  
  <p>I have no idea, what is going on or if the (in my opinion) strange behavior as anything to do with the problem. I appreciate any kind of help!</p>
  
  <p><strong>Piece from "UIManagerKeys.txt":</strong>
  Here are some keys for testing and reproducibility purposes...</p>
  
  <pre><code>FileView.computerIcon
  FileView.directoryIcon
  FileView.fileIcon
  FileView.floppyDriveIcon
  FileView.hardDriveIcon
  FormattedTextField.background
  FormattedTextField.border
  windowText
  </code></pre>
  
  <p><strong>My Code:</strong></p>
  
  <pre><code>package main;
  
  import java.io.File;
  import java.io.IOException;
  import java.nio.file.Files;
  import java.util.ArrayList;
  import java.util.Arrays;
  import javax.swing.UIManager;
  
  public class Main {
  
      public Main() {
      }
  
      public static void main(String args[]) {
          ArrayList&lt;String&gt; uiKeys = new ArrayList&lt;&gt;();
          String fileName = "recources/UIManagerKeys.txt";
          ClassLoader classLoader = new Main().getClass().getClassLoader();
  
          File file = new File(classLoader.getResource(fileName).getFile());
  
          // Check: is File found?
          System.out.println("File Found : " + file.exists());
  
          try {
              // Read File Content
              String content = new String(Files.readAllBytes(file.toPath()));
  
              // Split by line and collect
              String[] keys = content.split("\n");
              uiKeys.addAll(Arrays.asList(keys));
          } catch (IOException e) {
              System.out.println("Error: " + e);
          }
  
          // Output / Test - stream Keys
          System.out.println("Total Number of Keys: " + uiKeys.size());
          String suffix = ""; // Interesting behavior when String is not empty
          uiKeys.stream()
                  .map(key -&gt; key.replaceAll(" ", "").replaceAll("\n", "")) // Just to be sure
                  .forEach(key -&gt; System.out.println("IconFound: " + (UIManager.getIcon(key) != null) + "\tKey: " + key + suffix));
  
          // Output / Test - single Key
          System.out.println("\n");
          String key = "FileView.directoryIcon"; // Copied from console
          System.out.println("IconFound: " + (UIManager.getIcon(key) != null) + "\tKey: " + key + suffix);
      }
  }
  </code></pre>