Skip to content

Switch Slice(1,2, ...) API to create new Array without deferring #362

@simerplaha

Description

@simerplaha

These functions in CompanionSlice should create new Array directly to remove input type-check performed by scala.Array(a, b, c ... )

@inline final def apply[T: ClassTag](a: T, b: T, c: T): Slice[T] = Slice.wrap(Array(a, b, c))
@inline final def apply[T: ClassTag](a: T, b: T, c: T, d: T): Slice[T] = Slice.wrap(Array(a, b, c, d))
...

For example

@inline final def apply[T: ClassTag](a: T, b: T, c: T): Slice[T] = {
  val array = new Array[T](3)
  array(0) = a
  array(1) = b
  array(2) = c
  Slice.wrap(array)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    code cleanupTasks that require general code improvements to improve readabilitygood first issueGood for newcomersperformance

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions