public long size ( ) throws FileLockException , IOException { long size = 0L ; for ( int bucketId = 0 ; bucketId < hashFunction . getNumberOfBuckets ( ) ; bucketId ++ ) { HeaderIndexFile < Data > headerIndexFile = new HeaderIndexFile < Data > ( gp . DATABASE_DIRECTORY + "/" + hashFunction . getFilename ( bucketId ) , gp . HEADER_FILE_LOCK_RETRY , gp ) ; size += headerIndexFile . getFilledUpFromContentStart ( ) / gp . getElementSize ( ) ; headerIndexFile . close ( ) ; } return size ; }
Determines the number of elements in each buckets by opening all files .