<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=windows-1252"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
First --- it would probably be a really good idea for you to check out
the second binarySearch method in the Collections class found in the
Java  API.  <br>
<br>
In the first two examples where I am searching for objects willet1 and
willet2 using the nameComparator, the binarySearch method will return
the actual location in the ArrayList where the object that matches my
search is located.   When I search for willet5, which is not in the
list, the binarySearch method will return a negative number.  The
actual value that is returned can be used to find out where to insert
willet5 in the list so that the list remains sorted.  This equation is
found in the API.  In the program I used to compute the value of the
insertion point and then used the calculated insertion point to place
the willet5 object in the list.<br>
<br>
Does that clear things up?<br>
<br>
Each time I want to put a new object in the list that doesn't exist in
the list, I have to calculate the insertion point based on the value
returned from the binarySearch method.<br>
<br>
<blockquote
 cite="mid:684634811-1240348357-cardhu_decombobulator_blackberry.rim.net-1485957762-@bxe1254.bisx.prod.on.blackberry"
 type="cite">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <br>
  <blockquote cite="mid:892309.80966.qm@web37405.mail.mud.yahoo.com"
 type="cite">
    <style type="text/css"><!-- DIV {margin:0px;} --></style>
    <div
 style="font-family: times new roman,new york,times,serif; font-size: 12pt; color: rgb(0, 0, 0);">Dr.Pounds<br>
    <br>
I am confused about how your binary search method is working within the
print statement, I'm not sure of the purpose. Also, you changed the
value of the i
t times, why was that? I'm also confused about what each portion of the
insertion point variable actually does.  <br>
    <div> </div>
    <br>
    </div>
    <br>
  </blockquote>
  <br>
  <br>
  <pre class="moz-signature" cols="72">--  Andrew J. Pounds, Ph.D.  (<a
 moz-do-not-send="true" class="moz-txt-link-abbreviated"
 href="mailto:pounds@theochem.mercer.edu">pounds@theochem.mercer.edu</a>) Associate Professor of Chemistry and Computer Science Mercer University,  Macon, GA 31207   (478) 301-5627</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Andrew J. Pounds, Ph.D.  (<a class="moz-txt-link-abbreviated" href="mailto:pounds@theochem.mercer.edu">pounds@theochem.mercer.edu</a>)
Associate Professor of Chemistry and Computer Science
Mercer University,  Macon, GA 31207   (478) 301-5627
</pre>
</body>
</html>