title: converting Map to 2 dimension array
body: <p>I have a map and trying to convert that to 2 dimension array. For this I am converting the values of Map to list and then trying to convert to 2 dimensional array.</p>
  
  <p>My code is</p>
  
  <pre><code>try {
  List list = new ArrayList(layoutMap.values());
  int listSize = list.size();
  ArrayList[][] layoutList = new ArrayList[listSize][];
  for(int i = 0; i &lt; listSize; i++){
      List sublist = (ArrayList) list.get(i);
      int subListSize = sublist.size();
      layoutList[i] = new ArrayList[subListSize];
      for (int j = 0; j &lt; subListSize; j++) {
      layoutList[i][j] =  (ArrayList) sublist.get(j);
      }
  } 
  } catch (Exception e) {
  log.error("@layoutMapDetails () :", e);
  }
  </code></pre>
  
  <p>when i do this I am getting class cast exception <code>com.pojo.layout.LayoutDetails cannot be cast to java.util.ArrayList</code> Is there any way to solve this. Is the conversion of List to 2-dimensional array right..? Here the layoutMap is <code>Map&lt;Integer, List&gt;</code></p>