gsmafra gsmafra - 1 year ago 92
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download