The current approach works for both Java and Scala because of the @varargs annotation. But I will try the one you suggested.