Quote (Noobtard @ Jun 25 2016 03:32am)
Alrighty.
Currently my objects are:
Code
Event --> Location --> Points of Interest.
Basically I query for the event I'm on and all the children locations and all the locations points of interest records. On my page I just loop through my map that houses a list of Points of Interest. The reason I decided to choose this way is so that while I'm looping through the map on the page I have access to the Id of the current location / event of that point of interest. This is important because I could have a map of <Id, Events> // <Id, Location> and be able to access that map as I loop through my other one.
As I'm typing this... I think it would of been possible to query a List<Points of Interest> and just store the parent ids...
Is creating an inner class a form of encapsulation? I remember making 'Java Beans?' or something in school, but haven't outside of it. I will look more into encapsulation this weekend and might have some more questions.
as always thank you.
Also, I don't know how your java object is structured but you can easily avoid the maps with in maps if you put the Points of Interest ArrayList within the Location object and put the Location object within the Event object. Just assign a unique Id key to the Event object and do getters and setters for both the Location and Event object. Now you can avoid the maps within maps. You will have you new generic for the hashmap as this:
private Map<String, Event> eventMap = new HashMap<String, Event>();
The string will be the event.getId() which will return your unique id key and you have now successfully stored all your information in the Event object.
Use proper OOP and everything will be made simple for you.
Last tip: don't instantiate the map in the class level. Instantiate it within a static block or something of that sort.
This post was edited by umeshieee on Jun 25 2016 06:39pm