add support for arrays

added support for arrays by detecting when an array is used a collection type and by using ArrayList for adding items to the array.