The idea is to realize the possibility to store some string variables that are relating to each other. So that I can find one (or two) of the element using the other one (like in the code below). Database cannot be used. Code:
public static void main(String[] args) {
String[][] codesArrS = {{" ", "t", "n"}, {"231", "12223", "98745"}, {"Ver", "Gutva2", "Brezstel"}};
String var0 = "t";
String var1 = "231";
String var2 = "Brezstel";
for (int i = 0; i < 3; i++) {
if (var0.equals(codesArrS[0][i])) {
System.out.println("for var0=t we have var3 - " + codesArrS[2][i]);
}
if (var1.equals(codesArrS[1][i])) {
System.out.println("for var1=231 we have var3 - " + codesArrS[1][i]);
}
if (var2.equals(codesArrS[2][i])) {
System.out.println("for var2=Brezstel we have var3 - " + codesArrS[0][i]);
}
}
}
I used String 3D Array, but the problem is that it has fixed lenght. So I need to use some Collection, but can't find which one and how. As I now, List has only one parameter. Could someone, please, help me with the advice in which way to go or what is the better approach (maybe create a class and store objects...)?
...gratitude in advance!
>` would suit your needs
– PDStat Apr 05 '16 at 13:38