I need to read data from a CSV file and get an List< MyObject > as a result.
For example I have a Entry class:
public class Entry {
private String productId;
private LocalDate date;
private String state;
private String category;
private Double amount;
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
this.productId = productId;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
}
And a CSV file:
Order Date State Product ID Category Product Name Sales
08.11.2016 Kentucky FUR-BO-10001798 Furniture Bush Somerset Collection Bookcase 261,96
08.11.2016 Kentucky FUR-CH-10000454 Furniture Hon Deluxe Fabric Upholstered Stacking Chairs, Rounded Back 731,94
Can I get an List< Entry > from the CSV file using Stream API? Later I should be able to get data from the list and for example get total sales, total sales for a specific date and so on.
Thanks.