gsmafra gsmafra - 9 months ago 46
Scala Question

Scala method that returns the first string found in the alphabet/dictionary

For example this code

val stringTuple = ("BLACK", "GRAY", "WHITE")

Should return
. How would you define

Personally I prefer simple and fast implementations over complicated ones that would cover a lot of cases.

Answer Source

Turn the tuple into a single string, trim the parentheses out, split on the comma, sort, take the 1st element.