title: Java/Android: Append multiple strings, skip if string is null
body: <p>I have four strings I need to append.</p>
  
  <pre><code>String food = extras.getString("food");
  String file = extras.getString("file");
  String parcel = extras.getString("parcel");
  String others = extras.getString("others");
  
  String itemList = new StringBuilder(food).append("\n")
                        .append(file).append("\n")
                        .append(parcel).append("\n")
                        .append(others).toString();
  </code></pre>
  
  <p>This code will <code>prints</code>, if I choose <code>Food</code> and <code>File</code>.</p>
  
  <pre><code>Food
  File
  null
  null
  </code></pre>
  
  <p>Since <code>Parcel</code> and Others have no values (which is <code>null</code>), how to make it will print like below?</p>
  
  <pre><code>Food
  File
  </code></pre>
  
  <p>I tried to use <code>if else</code> but it will be too long (14 possibilities). Is there any other way to make it shorter and effective?</p>