Skip to content

Instantly share code, notes, and snippets.

@anderseriksson
Created April 24, 2012 20:25
Show Gist options
  • Save anderseriksson/2483422 to your computer and use it in GitHub Desktop.
Save anderseriksson/2483422 to your computer and use it in GitHub Desktop.
filterNotFirst function in Scala
def filterNotFirst(s: Seq[Any], v: Any): Seq[Any] = {
s.diff(Seq(v))
}
assert(filterNotFirst(Seq(1,2,2,2,3), 2) == Seq(1,2,2,3))
assert(filterNotFirst(Seq('a','a'), 'a') == Seq('a'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment