public static int getArrayLength ( Object obj ) { if ( obj == null ) { return 0 ; } IType type = TypeLoaderAccess . instance ( ) . getIntrinsicTypeFromObject ( obj ) ; if ( type . isArray ( ) ) { return type . getArrayLength ( obj ) ; } if ( obj instanceof CharSequence ) { return ( ( CharSequence ) obj ) . length ( ) ; } if ( obj instanceof Collection ) { return ( ( Collection ) obj ) . size ( ) ; } if ( obj instanceof Iterable ) { int iCount = 0 ; //noinspection UnusedDeclaration for ( Object o : ( Iterable ) obj ) { iCount ++ ; } return iCount ; } return 0 ; }
Return the length of the specified Array or Collection .