I am searching for short version for this kind of code:
if (database_1[0].equalsIgnoreCase(data)) {
preparedStatement = connect
.prepareStatement("update SLIP.CONTACTS set`database_1`=? where user='"
+ user + "'");
preparedStatement.setString(1, vnos );
preparedStatement.executeUpdate();
} else if (database_2[0].equalsIgnoreCase(data)) {
preparedStatement = connect
.prepareStatement("update SLIP.CONTACTS set`database_2`=? where user='"
+ user + "'");
preparedStatement.setString(1, vnos );
preparedStatement.executeUpdate();
}
So database_1[0] is a String array. And I need his first element to check if equals a string data. Is there a shortcut (for loop) to change database_1[0] to database_2[0] and then to database_3[0] and so on..thx in advance for help