add support for arrays

added support for arrays (object[]) by detecting when an array is used as collection type and by using ArrayList for adding items to the array.