@@ -92,18 +92,30 @@ public Insert value(String name, Object value) {
9292 * value in {@code values} will be inserted for the {@code i}th column
9393 * in {@code names}.
9494 * @return this INSERT statement.
95- *
9695 * @throws IllegalArgumentException if {@code names.length != values.length}.
9796 */
9897 public Insert values (String [] names , Object [] values ) {
99- if (names .length != values .length )
100- throw new IllegalArgumentException (String .format ("Got %d names but %d values" , names .length , values .length ));
101- this .names .addAll (Arrays .asList (names ));
102- this .values .addAll (Arrays .asList (values ));
103-
104- for (int i = 0 ; i < names .length ; i ++) {
105- checkForBindMarkers (values [i ]);
106- maybeAddRoutingKey (names [i ], values [i ]);
98+ return values (Arrays .asList (names ), Arrays .asList (values ));
99+ }
100+
101+ /**
102+ * Adds multiple column/value pairs to the values inserted by this INSERT statement.
103+ *
104+ * @param names a list of column names to insert/update.
105+ * @param values a list of values to insert/update. The {@code i}th
106+ * value in {@code values} will be inserted for the {@code i}th column
107+ * in {@code names}.
108+ * @return this INSERT statement.
109+ * @throws IllegalArgumentException if {@code names.size() != values.size()}.
110+ */
111+ public Insert values (List <String > names , List <Object > values ) {
112+ if (names .size () != values .size ())
113+ throw new IllegalArgumentException (String .format ("Got %d names but %d values" , names .size (), values .size ()));
114+ this .names .addAll (names );
115+ this .values .addAll (values );
116+ for (int i = 0 ; i < names .size (); i ++) {
117+ checkForBindMarkers (values .get (i ));
118+ maybeAddRoutingKey (names .get (i ), values .get (i ));
107119 }
108120 return this ;
109121 }
0 commit comments