I have an Object as follows:
public class Record{
Int ID;
String title;
Date date;
Duration time;
public Record createRecord(int ID, String title, Date date, Duration time){
this.ID= ID;
this.title = title;
this.date = date;
this.time = time;
return this;
}
}
I am storing multiple objects in a List. While inserting a new record, I need to check if the list already has an object with ONLY the same title and date, and replace the time in it.
I am looking for any solution which can achieve O(1) time.