Quantcast
Channel: alvinalexander.com - sequence
Viewing all articles
Browse latest Browse all 25

How to drop the first matching element in a Scala sequence

$
0
0

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.

read more


Viewing all articles
Browse latest Browse all 25

Trending Articles