0
I get a list that has several types of Htmlelements. I need a Namevaluepair list, with name and value of each object. So I have this function that gets the list:
private List getValoresPost(List parametros){
List<NameValuePair> param = new ArrayList<>();
parametros.forEach(parametro -> {
String type = parametro.getClass().getSimpleName();
param.add(new NameValuePair(((HtmlHiddenInput) parametro).getNameAttribute(), ((HtmlHiddenInput) parametro).getValueAttribute()
));
});
return param;
}
As I said, each object is of a different type, which I thought: take the name of the type of that object, and pass the cast parameter. In place of the (Htmlhiddeninput) I put the type but as an object. It has as?
Exactly that! Thank you very much.
– laaf