I need help to find out how to find something in java which is currently being done in sql. I need to find specific data in a list within a specific time duration using streams
scenario: I have a Bet Object with String CustId, Instant timestamp, Double betAmount
I need to find all customers which passed the 100.00 limit per 24 hour period, how would i do it in Java 8?
The method would be
public List<String> findLimits(List<Bet> bets){
...
}
sample data :
note: to be parsed in List<Bet>
A00001 2019-01-15T02:01:10 43.00
A00001 2019-01-15T04:00:00 13.00
A00001 2019-01-15T04:01:15 50.00
B00034 2019-01-15T05:00:00 15.00
A00001 2019-01-15T06:56:20 5.00
B00034 2019-01-15T06:57:00 20.00
C00004 2019-01-15T07:01:00 90.00
C00004 2019-01-15T07:11:00 30.00
B00034 2019-01-17T01:00:00 90.00
expected result:
["A00001","C00004"] (List<String>)
note: the list would contain all bets with diff cust id and chronological timestamps
The sliding 24 hour period and grouping the customers combined is a tricky one that i'm trying to solve.