title: Most efficient data structure for sorting an ArrayList by categorical factors
body: <p>I have created an object, let's call it EventObject, that will hold the results of an SQL query. Initially the objects will be aggregated into a single ArrayList. I am trying to develop a method that will look at each EventObject in the ArrayList, and if it equals a given value of a categorical factor, copies it to another group. </p>
  
  <p>For example, if a Timestamp value for EventObject1 falls on a Sunday, copy the object into a Sunday level of a Weekday factor; if that same Timestamp falls in the month of May, copy it into a May level of a Month factor as well, etc. </p>
  
  <p>I am stuck as to what type of data structure(s) would be most efficient for sorting. I do not know how many EventObject will fall into a level of a given factor, and the number of factors to be analyzed will be dependent upon an ID I pass to the method. It is required that I will have K factors, each with a known number of levels; and each level can have any number of EventObjects after the soring occurs. </p>
  
  <p>Should I attempt to hold all factors together in a single ArrayList? This requires a 3 dimensional structure. Would it be more prudent to create a separate data structure for each factor? </p>