Add collect() common function to collect portion of data from list of objects or arrays