@@ -271,22 +271,29 @@ object Tuple:
271
271
def unapply (x : EmptyTuple ): true = true
272
272
273
273
/** Convert an array into a tuple of unknown arity and types */
274
- def fromArray [T ](xs : Array [T ]): Tuple = {
274
+ def fromArray [T ](xs : Array [T ]): Tuple =
275
+ fromArray(xs, xs.length)
276
+
277
+ /** Convert the first `n` elements of an array into a tuple of unknown arity and types */
278
+ def fromArray [T ](xs : Array [T ], n : Int ): Tuple = {
275
279
val xs2 = xs match {
276
280
case xs : Array [Object ] => xs
277
281
case xs => xs.map(_.asInstanceOf [Object ])
278
282
}
279
- runtime.Tuples .fromArray(xs2)
283
+ runtime.Tuples .fromArray(xs2, n )
280
284
}
281
285
282
286
/** Convert an immutable array into a tuple of unknown arity and types */
283
- def fromIArray [T ](xs : IArray [T ]): Tuple = {
287
+ def fromIArray [T ](xs : IArray [T ]): Tuple = fromIArray(xs, xs.length)
288
+
289
+ /** Convert the first `n` elements of an immutable array into a tuple of unknown arity and types */
290
+ def fromIArray [T ](xs : IArray [T ], n : Int ): Tuple = {
284
291
val xs2 : IArray [Object ] = xs match {
285
292
case xs : IArray [Object ] @ unchecked => xs
286
293
case _ =>
287
294
xs.map(_.asInstanceOf [Object ])
288
295
}
289
- runtime.Tuples .fromIArray(xs2)
296
+ runtime.Tuples .fromIArray(xs2, n )
290
297
}
291
298
292
299
/** Convert a Product into a tuple of unknown arity and types */
0 commit comments