I have a requirement to create a 3-Dimensional ArrayList.
ArrayList<ArrayList< ArrayList<Object>>> data_Header_Mapper;
How can i populate the 3 D arraylist and how i acccess the leaf child ( Object) of 3 Dimensional ArrayList. Lots of thanks in advance for any help.
I am familiar working with Vectors , But due to some problems i want to convert the below code of Vectors to ArrayList. Code For Populating 3 D Vectors is as follows.
for (int r=0;r<totalRows;r++) // r - Rows
{
for (int c=0;c<totalViewedCols;c++) //c- Columns
{
cAct=0;
while (cAct < totalActualCols)
// for (int cAct=0;cAct<totalActualCols;cAct++) //c- Columns
{
if (Cols.get(cAct).toLowerCase().equals(columnName.toLowerCase()) )
{
ColValindex = colHeader_ForSave.indexOf(columnName) ;//Temp Comment
colValue= (String)data_ForSave.elementAt(r).get(ColValindex);
// ColValindex = header.indexOf(columnName) ;
// colValue= (String)data.elementAt(r).get(ColValindex);
data_Header_Mapper_Element.add(columnName);
data_Header_Mapper_Element.add(colValue);
}
cAct++;
}
if (data_Header_Mapper_Element.size() !=0)
{
data_Header_Mapper_Row.add(data_Header_Mapper_Element);
// data_Header_Mapper_Element.removeAllElements();
data_Header_Mapper_Element =null;
data_Header_Mapper_Element=new Vector<String>();
}
}
if (data_Header_Mapper_Row.size() !=0)
{
data_Header_Mapper.add(data_Header_Mapper_Row);
data_Header_Mapper_Row =null;
data_Header_Mapper_Row=new Vector<Vector<String>>();
}
}
Code For Access 3 D Vectors is below
for(int r=0;r<rowSize;r++)
{
for (int c=0;c<colSize;c++)
{
// To Build Insert And Update Query
columnDataType= dbe.GetDataTypeOfTableColumn(rsMetaData,data_Header_Mapper.elementAt(r).get(c).get(0).toString());
dataSize=dbe.GetDataSizeOfTableColumn(rsMetaData,data_Header_Mapper.elementAt(r).get(c).get(0).toString());
Validation.ValidateData(columnDataType, data_Header_Mapper.elementAt(r).get(c).get(1), dataSize);
}
}