Support use of an object generation function for putAll or addAll.

It's not always convenient to pass an array in. Sometimes it's easier to
have a function that enumerates the objects to be added.