Questions about the apply method of Array

val a = Array
a (1)
where a (1) should be called the apply method of class Array
I don"t see where the specific implementation is in the source code. How to get the data here?

  /** The element at given index.
   *
   *  Indices start at `0`; `xs.apply(0)` is the first element of array `xs`.
   *  Note the indexing syntax `xs(i)` is a shorthand for `xs.apply(i)`.
   *
   *  @param    i   the index
   *  @return       the element at the given index
   *  @throws       ArrayIndexOutOfBoundsException if `i < 0` or `length <= i`
   */
  def apply(i: Int): T = throw new Error()
Jan.27,2022

Why it hasn't been approved yet.


https://www.scala-lang.org/api/current/scala/Array.html-sharpapply(idx:Int):A
Implicit

This member is added by an implicit conversion from Array [T] to ArrayOps [T] performed by method genericArrayOps in scala.Predef.

Shadowing

This implicitly inherited member is shadowed by one or more members in this class.
To access this member you can use a type ascription:
(array: ArrayOps [T]). Apply (idx)
Definition Classes
SeqLike regions GenSeqLike
Exceptions thrown
IndexOutOfBoundsException if idx does not satisfy 0 < = idx < length.


this problem involves the implicit conversion mechanism in the Scala language.

scala.Predef.genericArrayOps(a).apply(1)

you only need to look at the source code of ArrayOps in Idea to confirm where the specific implementation logic of apply is.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35f4b-2bfeb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35f4b-2bfeb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?