Quantcast
Channel: remove
Viewing all articles
Browse latest Browse all 10

How to drop the first matching element in a Scala sequence

0
0

How to drop the first matching element in a Scala sequence

Summary: This blog post shows one way to drop/filter the first matching element from a Scala sequence (Seq, List, Vector, Array, etc.). I don’t claim that the algorithm is efficient, but it does work.

Background

While creating some Scala test code earlier today I had an immutable list of toppings for a pizza, and I got into a situation where I wanted to remove the first instance of a topping.


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images