/** * Searches the receiver for the specified value using * the binary search algorithm. The receiver must <strong>must</strong> be * sorted (as by the sort method) prior to making this call. If * it is not sorted, the results are undefined: in particular, the call * may enter an infinite loop. If the receiver contains multiple elements * equal to the specified object, there is no guarantee which instance * will be found. * * @param key the value to be searched for. * @return index of the search key, if it is contained in the receiver; * otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>. The <i>insertion * point</i> is defined as the the point at which the value would * be inserted into the receiver: the index of the first * element greater than the key, or <tt>receiver.size()</tt>, if all * elements in the receiver are less than the specified key. Note * that this guarantees that the return value will be >= 0 if * and only if the key is found. * @see java.util.Arrays */ public int binarySearch(char key) { return this.binarySearchFromTo(key, 0, size-1); } /**
/** * Searches the receiver for the specified value using * the binary search algorithm. The receiver must <strong>must</strong> be * sorted (as by the sort method) prior to making this call. If * it is not sorted, the results are undefined: in particular, the call * may enter an infinite loop. If the receiver contains multiple elements * equal to the specified object, there is no guarantee which instance * will be found. * * @param key the value to be searched for. * @return index of the search key, if it is contained in the receiver; * otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>. The <i>insertion * point</i> is defined as the the point at which the value would * be inserted into the receiver: the index of the first * element greater than the key, or <tt>receiver.size()</tt>, if all * elements in the receiver are less than the specified key. Note * that this guarantees that the return value will be >= 0 if * and only if the key is found. * @see java.util.Arrays */ public int binarySearch(char key) { return this.binarySearchFromTo(key, 0, size-1); } /**