What if my argument A is not a single Context but I want also to pass something else along with it?
Sevastyan Savanyuk
11

You could use a Pair or a custom data class with 2 or more values as A, then add a custom getInstance() definition in your companion object with the individual values as arguments (with optional default values).
Alternatively you could write a version of SingletonHolder accepting more than one argument.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.