IterableUtils size() function deletes all elements from the object

19 Views Asked by At

I have an API which returns an Iterable object. When I tried logging the same object's size using org.apache.commons.collections4.IterableUtils.size(iterable) fuction, I observed that the this API is deleting the elements inside the collection object. I verified it by logging the same data twice as below -

System.out.println("First size check :" + IterableUtils.size(myIterable));
System.out.println("Second size check :" + IterableUtils.size(myIterable));

Output -

First size check :150
Second size check :0

Has anyone else faced such issues with apache common-collections 4.4 utility? IMO, this should not happen.

0

There are 0 best solutions below