I'm trying to learn more about comparators and streams and I was wondering the best solution to sort an array of objects with key values, sorting alphabetically by the value. Any help is hugely appreciated!
Example Array:
[
{key: "93743743", value: "Mary Smith"},
{key: "6624c357", value: "Tom Spitz"},
{key: "03453459", value: "John Doe"},
{key: "24623145", value: "Ernie Ball"}
]
Expected Result:
[
{key: "24623145", value: "Ernie Ball"}
{key: "03453459", value: "John Doe"},
{key: "93743743", value: "Mary Smith"},
{key: "6624c357", value: "Tom Spitz"},
]
Having a bit of trouble with the exact syntax using it in a stream (using a stream to subsequently filter and return an array of the names). Could also filter the array after if easier.