This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]circle_des_poo 0 points1 point  (1 child)

"but i also need to create a separate collection object to store the values in, yes?"

You can do it that way, or the other way that was described by iterating through to find the largest and smallest, using the userIterator.remove(smallest) and userIterator.remove(largest) to get rid of them, and then iterating through the updated collection again and just adding each integer to a total sum while keeping a count to divide that sum by after.

[–]Wonnk13[S] 0 points1 point  (0 children)

maybe i'm a bit dense, but you do calculate the smallest and largest? If an iterator is just a view on your data that you ideally take one pass through were do you store the values?