add collect(T,itr) method [close #4679]