so every time i run the program and enter the 2nd choice, it tells me rangecheck error , index0 , size 0.
what i understand from this after research is that the arraylist is empty, how do i use the add function in the 2D arraylist?
|ABCDEFGHIJKLMNOPQRSTUVWX
--+------------------------
01|gggggggggggggggggggggggg
02|gGGGGGGGGGGGGGGGGGGGGGGg
03|gGggggggggggggggggggggGg
04|gGgYYYYYYYYYYYYYYYYYYgGg
05|gGgYggggggggggggggggYgGg
06|gGgYggggggggggggggggYgGg
07|gGgYggYYYYYYYYYYYYggYgGg
08|gGgYggYggggggggggYggYgGg
09|gGgYYYYggggggggggYYYYgGg
10|gGggggggggggggggggggggGg
11|gGGGGGGGGGGGGGGGGGGGGGGg
12|gggggggggggggggggggggggg
package map;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Scanner;
import java.util.ArrayList;
public class MapMain
{
public static void main(String [ ] args)
{
Scanner input = new Scanner(System.in);
InputStream is = null;
int i;
char c;
String T;
ArrayList<ArrayList<String>> Contain = new ArrayList<ArrayList<String>>();
for(int L = 0; L < 30; L++)
{
Contain.add(new ArrayList<String>());
}
try{
do{
int a=0;
String Elements;
System.out.print("To load map enter 1\nTo print loded map enter 2\nTo change specific elements press 3 ");
a=input.nextInt();
switch (a){
case 1 :
System.out.print("What is the file dest?");
T=input.nextLine();
is = new FileInputStream(T);
while((i=is.read())!=-1)
{
c=(char)i;
String O = "ankosh";
//Contain.add(Contain.O);
}
break;
case 2:
while(true)
{
String U = Contain.get(16).get(0);
//System.out.print(Contain);
break;
}
break;
case 3:
System.out.print("What do you want to insert?");
Elements=input.nextLine();
//switch (Elements){
//case
}
break;
} while(true);
}catch(Exception e){
// if any I/O error occurs
e.printStackTrace();
}finally{
}
}
}