title: use if-else statement in java-8 lambda expression
body: <p>I have a for-statement in java-7 and it's work fine:</p>
  
  <pre><code>Character cha = new Character(',');
  String ncourseIds = null;
  String pastCourseIds = null;
  for (EquivalentCourse equivalentCourse : equivalentCourses) {
    if(equivalentCourse.getNcourse() != null){
      ncourseIds += equivalentCourse.getNcourse().getId()+ ",";   
    } else if(equivalentCourse.getPastCourse() != null) {
      pastCourseIds +=equivalentCourse.getPastCourse().getId()+","; 
    }
  }
  if(!ncourseIds.isEmpty() &amp;&amp;cha.equals(ncourseIds.charAt(ncourseIds.length()-1))) {
    ncourseIds = ncourseIds.substring(0, ncourseIds.length()-1);
  }
  if(!pastCourseIds.isEmpty()&amp;&amp; cha.equals(pastCourseIds.charAt(pastCourseIds.length()-1))) {
    pastCourseIds = pastCourseIds.substring(0,pastCourseIds.length()-1);
  }
  </code></pre>
  
  <p>Now I want to convert my code to <code>Stream</code> &amp; <code>collect</code> in java-8, I implement half of my business about filter not null <code>Ncourse</code>:</p>
  
  <pre><code>equivalentCourses.stream().filter(obj -&gt; obj.getNcourse() != null )
                   .map(obj -&gt; obj.getNcourse().getId()).collect(Collectors.joining(",")); 
  </code></pre>
  
  <p>but I don't know to implement it's <code>else-statement</code>. any help?</p>