public override int CompareTo(VirtualValue other, IComparer <AnyValue> comparator) { if (!(other is ListValue)) { throw new System.ArgumentException("Cannot compare different virtual values"); } ListValue otherList = ( ListValue )other; if (IterationPreference() == RANDOM_ACCESS && otherList.IterationPreference() == RANDOM_ACCESS) { return(RandomAccessCompareTo(comparator, otherList)); } else { return(IteratorCompareTo(comparator, otherList)); } }