I am working on a system and restricted to using Java 1.4
I have some working code but when declaring an Array I am having to set an Array size large enough to provide for now and the future (as Generics such as ArrayLists and Collections don't seem possible until 1.5). The issue is then when I read through the Array my code crashes at the first null value.
Now I can program to check for the null value and exit the read through, but is there a better way in 1.4? How would you best go about a dynamically sized array in 1.4?
Snippet:
String query = "select Partition.* from Partition where Name like 'SS%'";
if(debug) jcsOut.println("Finding Partitions");
String[][] partitions = new String[800][3];
int i = 0;
for (Iterator it = jcsSession.executeObjectQuery(query, null); it.hasNext()
{
Partition p = (Partition) it.next();
if(debug) jcsOut.println(p.getName());
partitions[i][0] = p.getName();
if(p.getName().substring(2,4).equals("BA"))
{
//jcsOut.println("MATCH");
if(debug) jcsOut.println(p.getName().substring(2,4));
partitions[i][1] = p.getName().substring(2,4);
if(debug) jcsOut.println(p.getName().substring(5,9).replace( "_","")+p.getName().substring(9).replace("_","-"));
partitions[i][2] = p.getName().substring(5,9).replace("_","")+p.getNa me().substring(9).replace("_","-");
} else if (p.getName().substring(0,2).equals("SS"))
{
//jcsOut.println("MATCH");
if(debug) jcsOut.println(p.getName().substring(0,2));
partitions[i][1] = p.getName().substring(0,2);
}
if(debug) jcsOut.println(" ");
i++;
}