Curated articles, resources, tips and trends from the DevOps World.
Summary: This is a summary of an article originally published by the source. Read the full original article here →
If the Java method accepts a variable arguments (varargs) parameter and we want to invoke the method from Clojure we must pass an array as argument. To create an array in Clojure we can use several functions.
For primitive type arrays we can use for example int-array to get a int[] array.
Once we have the array we can use it as argument value for the varargs parameter of the Java method we want to invoke. In the following example we use into-array, to-array and short-array to invoke a Java method with varargs parameter and see how we can build different array types: Written with Clojure 1.10.1.
Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com