How to get quantity of items from an ArrayList?

3

I'm trying to count how many items it contains in a ArrayList , I already have something ready:

private int quantidadeN = listaNotificacaos.size();

It should save the amount inside the variable quantidadeN , but when I play the page it brings a result 0.

On the page I'm calling with this code:

#{notificacaoControle.quantidadeN}

Can anyone help me?

    
asked by anonymous 20.06.2016 / 20:47

1 answer

3

The problem is that when the variable quantidadeN was set, the size () was equal to 0.

Use the collection itself in your EL:

#{notificacaoControle.listaNotificacoes.size()}
    
20.06.2016 / 21:31