Matt Klaver Matt Klaver - 3 years ago 169
Java Question

Conditionally add an item to an array in Java

I'm trying to figure out how to add an item to an array based on the return value of a method.

Something like where in a method you can do

return array.contains(value)
and automatically return a boolean, but in a way where you can, instead of returning that value, add it to an array?

Is this possible in the same format, where you don't need a conditional statement?

Sorry for the noonish question, and thanks for the help!

Answer Source

I think what you mean is this:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download