0

Can anybody tell me if its possible to convert a DataModel to an ArrayList?

And how can I do it? Please I have to know it as soon as possible!!!

I can convert the ArrayList to ListDataModel using new ListDataModel(List list), but I don't know how to do the inverse!

ex:

public void filtrarCamadaPorCategoriaEFabricante(){
        this.listaDeCamadasParaEscolha = new ListDataModel<Camada>(this.service.getServiceComponentesConstrutivos().filtrarCamadaPorCategoriaEFabricante(idCategoriaDeCamadaASerAdicionada, idFabricanteDeCamadaAserAdicionada));
}
eLRuLL
  • 18,488
  • 9
  • 73
  • 99
Diego Sabino
  • 47
  • 3
  • 9
  • With the information you gave us the only answer is: have a look inside the documentation of The ListDataModel. Please provide some additional information, e.g. the package names of DataModel (and ArrayList if it is not java.util.ArrayList). If DataModel is an interface it might be a good idea to implement a kind of wrapper for an ArrayList that implements this interface. – mschenk74 May 14 '13 at 16:05

1 Answers1

2

Looks like DataModel has an iterator http://docs.oracle.com/javaee/6/api/javax/faces/model/DataModel.html#iterator()

You should be able to use this iterator to iterate the contents on the DataModel and create an ArrayList.

Sumit
  • 1,661
  • 1
  • 13
  • 18