I have an array containing the following values
final String[] headers = { "abc", "def", "rty", "yui" };
now i am iterating over the excel sheet cells by using apache poi as shown below
for (Row row : firstSheet) {
for (Cell cell : row) {
if ("abc".equals(cell.getStringCellValue())) {
now as shown below the value "abc" is hardcoded that is i want to customize it in such a way that when cell value is read then it should be matched from witih in the array i want to remove this hard coding so in other words the cell value is read which will always be a string and then that same value is searched with in the array itself please advise how to customise this
You can create
List
instead ofArray
and then usecontains
method in if clause.