method to check type of collection