Which method is more efficient String.equals(String s) or String.contains(String s)
<p>For example, if I have a the following:</p>

<pre><code>String s = "Alexander";
</code></pre>

<p>which is more efficient in this case, checking:</p>

<pre><code>if(s.contains("Alexander"))
return true;
</code></pre>

<p>OR</p>

<pre><code>if(s.equals("Alexander"))
return true;
</code></pre>

<p>Please note that this is just a basic example, all I need to know is understanding the root of method..Which is more efficient or faster?</p>
