I'm writing a program that has an ArrayList<String> s. Is there a way to get each value from the ArrayList and set them to separate variables? For example:
String s0 = s.get(0);
String s1 = s.get(1);
String s2 = s.get(2);
.
.
.
String sn = s.get(n);
I will know what 'n' is but it will change based on user input. I just don't know how to/if I can dynamically create variables based on some number n. Any help would be much appreciated!
ArrayListand put those in a 2d array. For examples1 = AAAs2 = ABAs3 = ABCs1s2 = 1s1s3 = 2s2s3 = 1and then put those values into a difference matrix. I guess I can just compare the values as I fill the matrix based on i and j since [0][0] would be s1s1 [0][1] would be s1s2 ect. I just didn't know if there was an easier way