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.