Filter a CSV file and re-arrange it by category #eg60

Filter a CSV file and re-arrange it by category #eg60


The CSV file below has 4 columns: idSale (id), Movie (movie name), Genre and Director:

Use Java to implement a task: filter the file using Director as the argument, group it by Genre, and print data in the order of genre and then movie names. For example, when argument is set as Christopher Nolan, we have the following result:

Image description

Here is SPL script:

Image description

A1: Open the CSV file and filter it by director.

A2: Group the file by Genre and loop to compute one group each time.

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

SPL open source address

Download



Source link
lol

By stp2y

Leave a Reply

Your email address will not be published. Required fields are marked *

No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.