title: Getting NullPointerException while using Lambda expression
body: <p>Following code was an existing code in my project, using the same concept, I am updating the project,</p>
  
  <pre><code>public static List&lt;Option&gt; filterNetworkSettingsOptionBySetting(NetworkSettingsGroup group,
          String settingName) {
      LOGGER.info("************ Filtering Option based on SettingName ************");
      LOGGER.info("***** Setting Name "+settingName);
      List&lt;Option&gt; newOptions = new ArrayList&lt;Option&gt;();
      if (group == null || group.getOptions() == null || group.getOptions().isEmpty()
              || StringUtils.isBlank(settingName))
          return newOptions;
  
      List&lt;Option&gt; oldOptions = group.getOptions();
      LOGGER.info("Before Filtering Options "+oldOptions);
      Stream&lt;Option&gt; stream = oldOptions.stream();
      LOGGER.info("Before Filtering Stream "+stream);
  
      newOptions.addAll(group.getOptions().stream()
              .filter(option -&gt; option.getName().equalsIgnoreCase(settingName)).collect(Collectors.toList()));
  
      return newOptions;
  }
  </code></pre>
  
  <p>I am getting NullPointerException at </p>
  
  <pre><code>newOptions.addAll(group.getOptions().stream()
              .filter(option -&gt; option.getName().equalsIgnoreCase(settingName)).collect(Collectors.toList()));
  </code></pre>
  
  <p>this step..
  I am not able to understanding that step, can anyone explain me the step clearly... what is happening in that step and how can I divide that step into multiple steps(because I want to check in method call null is coming).</p>