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

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

This widget could not be displayed.
$array.size() works
This widget could not be displayed.
Davin Studer Community Champion Nov 11, 2014

This should work.

$userAccessor.getUsers().size()
Davin Studer Community Champion Nov 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.

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

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Aug 06, 2018 in Agile

Boosting team's visibility with ScriptRunner like a boss

Just like almost every team here we are struggling with visibility both internal and external each day. I want to share a short story about how we have improved the internal part by a great deal and ...

329 views 0 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you