Count of elements arriving at a given point at the same time
int count = 1 ; while ( ( i < ( T . size ( ) - 1 ) ) && ( Double . compare ( T . get ( i ) , T . get ( i + 1 ) ) == 0 ) ) { count += 1 ; i += 1 ; } total += ( count * ( count - 1 ) ) / 2 ; i += 1 ; } return total ; }