a finite input range
a finite input range
true if both ranges have the same length, false otherwise.
assert(isSameLength([1, 2, 3], [4, 5, 6])); assert(isSameLength([0.3, 90.4, 23.7, 119.2], [42.6, 23.6, 95.5, 6.3])); assert(isSameLength("abc", "xyz")); int[] a; int[] b; assert(isSameLength(a, b)); assert(!isSameLength([1, 2, 3], [4, 5])); assert(!isSameLength([0.3, 90.4, 23.7], [42.6, 23.6, 95.5, 6.3])); assert(!isSameLength("abcd", "xyz"));
Checks if the two ranges have the same number of elements. This function is optimized to always take advantage of the length member of either range if it exists.
If both ranges have a length member, this function is O(1). Otherwise, this function is O(min(r1.length, r2.length)).