/** Returns the number of elements added so far, unless it is too big to fit in an integer (in which case this method will throw an * exception). * * @return the number of elements added so far. */ public int size() { final long length = length(); if ( length > Integer.MAX_VALUE ) throw new IllegalStateException( "The number of elements of this bit list (" + length + ") exceeds Integer.MAX_INT" ); return (int)length; }
/** Returns the number of elements added so far, unless it is too big to fit in an integer (in which case this method will throw an * exception). * * @return the number of elements added so far. */ public int size() { final long length = length(); if ( length > Integer.MAX_VALUE ) throw new IllegalStateException( "The number of elements of this bit list (" + length + ") exceeds Integer.MAX_INT" ); return (int)length; }