how to get the number of items in a velocity array list?

Stefan Baader November 10, 2014

I have some useful user macros to help me administrating our wiki.

I would like to get quickly the total size of users from the user store. I cant get a list of all users with that method:

$userAccessor.getUsers()

But how can I get the size of the list without looping it by foreach?

2 answers

Suggest an answer

Log in or Sign up to answer
1 vote
Stefan Baader September 27, 2017
$array.size() works
0 votes
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 11, 2014

This should work.

$userAccessor.getUsers().size()
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 12, 2014

Oh wait! It doesn't actually return an array, so .size() won't work. I think you might have to loop through it.

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 12, 2014
Stefan Baader November 13, 2014

Many thanks. The size() methode I tried also without success. So looping is the only solution?

TAGS
AUG Leaders

Atlassian Community Events