Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is there a way to use a date as an Array

I need to assign an appointment of sort to a list of names. A maximum of 10 names per day. I was thinking of making the date into an Array so that each date would store a set of names but I am not even sure how to implement that

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You can do it using a Hashmap for example.

Map<Date, Set<String>> namesByDate = new HashMap<Date, Set<String>>();       
Date d = new Date(); // 4 July 2022
Set<String> names = new HashSet<>();
names.add("TEST1");
names.add("TEST2");
namesByDate.put(d, names);
System.out.println(namesByDate);        
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading