vendredi 11 mars 2016

Selection of Array depending on variable in Java


I am sure that this post silly, while I need still some practical ideas. I have 20 double[] arrays named like colVal1, colVal2,... Now I have 5 variables say que1, que2, que3, que4, que5 which contain integers from 1 to 20. I want to use arrays depending on the value contained in quei. Means if que1 contains 3 then I like to use colval3 in calculation. Manual use is avoidable due permutations of 20 numbers in 5 variables. Google hints that Java, in principle avoid replacement of variable name by another variable. I am lost at using HashMap. I could not use Reflection APIs correctly due to my limited knowledge base. Any handle is welcome.
Thanks and Regards





Aucun commentaire:

Enregistrer un commentaire