correct use of optional argument in java