Filter a CSV file according to condition and output result as a list

We have a CSV file whose format is “category + detail data”:
Name,Colour
Chair,Blue
Chair,Green
Chair,Yellow
Table,Purple
Table,Pink
Door,Yellow

Task: Use Java to query the file. The input parameter is category and the output result is a detail data list. For example, input Chair and the output is Blue,Green,Yellow.

Here is the SPL code:
=T($[data.csv]).select(Name==?).(Colour)
The T()function parses the CSV file; $[] represents a string.

Read How to Call a SPL Script in Java to find how to integrate SPL into a Java application.

Source: https://stackoverflow.com/questions/74693048/how-can-i-use-java-to-create-a-list-of-all-the-values-from-csv-file-that-have-th