title: How to filter out list elements that are indexed after an element that fullfills a condition?
body: <p>I have this list:</p>
  
  <pre><code>var ls = List("Should be ignored", "X", "test", "test1", "X", "test2")
  </code></pre>
  
  <p>I was wondering if someone knows how I could filter out the elements in the list which are right after the "X" so that the result is:</p>
  
  <pre><code>List("test", "test2")
  </code></pre>
  
  <p>So far I have tried:</p>
  
  <pre><code>  ls.filter(x =&gt; x._2.equals("X"))
  </code></pre>
  
  <p>However that simply bring back this result:</p>
  
  <pre><code>List((0,This line should be ignored, because it is before the first predicate), (2,Lorem ipsum dolor sit amet, consectetur adipiscing elit.), (3,Suspendisse aliquet quis ligula nec tristique.), (5,Donec augue ipsum, mattis et elit vel, convallis convallis dui.), (7,In hac habitasse platea dictums.))
  </code></pre>