sorting and searching an arraylist
<p>I've looked at the posts on here to do with sorting and searching but can't seem to get my arraylist to sort or search using</p>

<pre><code>Collections.sort(myarraylist);
</code></pre>

<p>The data that is stored in the arraylist is only stored when the user enters data in textfields in a GUI. I have used getText to store the data (that the user enters into the JTextFields) in the arraylist.</p>

<p>The user should be able to enter a firstname or surname into a</p>

<pre><code>String searchstring = JOptionPane.showInputDialog("Enter Name");
</code></pre>

<p>The sort should be done after the user adds the each new contact into the arraylist by surname.</p>

<p>So my question is:</p>

<ol>
<li>How can I sort the arraylist?</li>
<li>How can I search the arraylist?</li>
</ol>

<p>Please can you advise me how to proceed as I am really stuck!!</p>
