0
`誰かが私にこの問題を助けたり、別の方法で助けてくれるのだろうかと思います。私はtestNGフレームワークを使用してJavaでコーディングするセレンwebdriverを使用しています。arraylistsを含む関数から複数の文字列値を抽出するには
基本的に、私はExcelからデータを抽出し、それらをarraylistsとして保存する方法を持っています。したがって、たとえば、私は
この種のデータを持っている:
Region Text1 Text2 Text3
UK uk_t1 uk_t2 uk_t3
usa usa_t1 usa_t2 usa_t3
russ rus_t1 rus_t2 rus_t3
私の方法は、列名
例 -
Arraylist<String>region = new ArrayList<String>();
Arraylist<String>text1 = new ArrayList<String>();
Arraylist<String>text2 = new ArrayList<String>();
Arraylist<String>text3 = new ArrayList<String>();
ArrayList<String> mydatacells = dataFromExcel(xlspath) // the method on the right is the one with the excel function
String xlspath = "example/mylocation";
int uk = 4; //location of the cell that contains the string uk
int usa = 8; //location of the cell that contains the string usa
int russ = 12; //location of the cell that contains the string russ
に基づいてExcelとのArrayListに格納するからすべての情報を抽出し、
次に、以下のようにして、地域固有のデータを抽出します。
for(uk=4; uk<usa; uk++){
region.add(mydatacells.get(uk));
text1.add(mydatacells.get(uk));
text2.add(mydatacells.get(uk));
text3.add(mydatacells.get(uk));
} //the code assigns the value for uk
私の問題は、私は別の方法でこれらの値を使用する必要があり、私はすべてのデータを取得する必要があることです。
これを行う方法やこれを効率的に行う方法を知っている人はいますか?
おかげ
ありがとう。私はそれを試して、それがどうなるか見てみましょう。 –
私はarraylistの代わりにマップを使用しようとしましたが、私はこれを行いました: –
Map map = dataFromExcel(xlsPath) –