W0lf7
W0lf7

Reputation: 759

Good method practice in Java

In my Android application I have a new intent which is launched depending on the results and returns of some other methods, so I've launched the intent this way:

methodOne(methodTwo(methodThree()));

This is the code for launch search results:

private void methodOne(ArrayList<String> identities) {
    Intent intent = new Intent(Class.this, AnotherClass.class);
    intent.putStringArrayListExtra("aList", identities);
    startActivity(intent);
}

This currently works fine, and I get the results I want. I just wondered if the way I am calling this method is good or bad practice as I don't really know myself.

Upvotes: 2

Views: 172

Answers (1)

bsimic
bsimic

Reputation: 926

If you are passing the ArrayList of event identities to the function when you call it, there is no need to do the:

eventIdentities = getEventIdentities(searchResults); 

because you already have the ArrayList being passed into the method so you can use it.

Upvotes: 3

Related Questions