Nested methods vs "piped" methods, which is better?
<p>Since uni, I've programming in Java for 3 years, although I am not fully dedicated to this language, I have spent quite some time in it, nevertheless. I understand both ways, just curious which style do you prefer.</p>

<p>Please focus at the main method - that's the section I concern the most.</p>

<pre><code>public class Test
{
    public static void main(String[] args)
    { 
        System.out.println(getAgent().getAgentName());
    }

    private static Agent getAgent()
    {
        return new Agent();
    }
}
class Agent
{
    private String getAgentName()
    {
        return "John Smith";
    }
}
</code></pre>

<p>I am pretty happy with nested method calls such like the following</p>

<pre><code>public class Test
{
    public static void main(String[] args)
    { 
        System.out.println(getAgentName(getAgent()));
    }

    private static String getAgentName(Agent agent)
    {
        return agent.getName();
    }

    private static Agent getAgent()
    {
        return new Agent();
    }
}
class Agent
{
    public String getName()
    {
        return "John Smith";
    }
}
</code></pre>

<p>They have identical output I saw "John Smith" twice.</p>

<p>I wonder, if one way of doing this has better performance or other advantages over the other. Personally I prefer the latter, since for nested methods I can certainly tell which starts first, and which is after.</p>

<p>The above code is but a sample, The code that I am working with now is much more complicated, a bit like a maze... So switching between the two styles often blows my head in no time.</p>
