I’m sorry if this is a very basic but I couldn’t find anything in my books and searching. I am trying to send information when creating an object but there’s many options and I only really to change one(unfortunately, its near the end).
Say I have something like this:
class_to_start_(int maxActive,
byte whenExhaustedAction,
long maxWait,
int maxIdle,
int minIdle,
boolean testOnBorrow,
boolean testOnReturn,
long timeBetweenEvictionRunsMillis,
int numTestsPerEvictionRun,
long minEvictableIdleTimeMillis,
boolean testWhileIdle,
long softMinEvictableIdleTimeMillis,
boolean lifo)
They all have default values so I don’t need to change any of them, but I want to modify the default value of the last one lifo only. Can I do it without sending values to all others? Ideally something like class_to_start_('lifo'=True) (this doesn’t work, I tried it).
Is this possible?
Java doesn’t have default parameter values, so the short answer is no.
You can have overloaded constructors however, so that you have a constructor that just takes the argument you want to change:
You could also look at making a fluent interface builder object. The idea then would be you do: