10000 Use List.fill instead of range [ci: last-only] by som-snytt · Pull Request #11059 · scala/scala · GitHub
[go: up one dir, main page]

Skip to content

Use List.fill instead of range [ci: last-only] #11059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use List.fill instead of range
  • Loading branch information
som-snytt committed May 20, 2025
commit f3ad9d7656e9c152ff1293b6faf80b086e71fc5c
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ abstract class ClassfileParser(reader: ReusableInstance[ReusableDataReader]) {
val parentIndex = u2()
val parentName = if (parentIndex == 0) null else pool.getClassName(parentIndex)
val ifaceCount = u2()
val ifaces = for (_ <- List.range(0, ifaceCount)) yield pool.getSuperClassName(index = u2())
val ifaces = List.fill(ifaceCount.toInt)(pool.getSuperClassName(index = u2()))
val completer = new ClassTypeCompleter(clazz.name, jflags, parentName, ifaces)

enterOwnInnerClasses()
Expand Down
8 changes: 4 additions & 4 deletions src/library/scala/collection/Factory.scala
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ trait IterableFactory[+CC[_]] extends Serializable {
def newBuilder[A]: Builder[A, CC[A]]

/** Produces a $coll containing the results of some element computation a number of times.
* @param n the number of elements contained in the $coll.
* @param elem the element computation
* @return A $coll that contains the results of `n` evaluations of `elem`.
*/
* @param n the number of elements contained in the $coll.
* @param elem the element computation
* @return A $coll that contains the results of `n` evaluations of `elem`.
*/
def fill[A](n: Int)(elem: => A): CC[A] = from(new View.Fill(n)(elem))

/** Produces a two-dimensional $coll containing the results of some element computation a number of times.
Expand Down
0