Printing ArrayList<String> into output? : <p>So, i have ArrayList which i store animals in.</p>

<pre><code>private ArrayList&lt;Animal&gt; catalog = new ArrayList&lt;&gt;();
</code></pre>

<p>Now, i need to print the catalog into my output when i press 4 into my output.</p>

<pre><code>case 4:
                System.out.println("List of animals: ");
                printIt();   //Function to print catalog
                break;
</code></pre>

<p>I tried to do it with </p>

<pre><code>    private boolean InList(String name) {
    for (int i = 0; i &lt; catalog.size(); i++) {
        if (name.equalsIgnoreCase(catalog.get(i).getName())) {
            return true;
        }
    }
    return false;
}
</code></pre>

<p>But it's not working. Can you guys help me to get this piece of code?</p>
