package control
- Alphabetic
- By Inheritance
- control
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- macro def fillArrayOfInt(times: Int)(f: Int): Array[Int]
- def fillArraySeq[T <: AnyRef](times: Int)(f: => T)(implicit classTag: ClassTag[T]): ArraySeq[T]
Evaluates the given expression
f
with typeT
the given number oftimes
and stores the result in a scala.collection.immutable.ArraySeq.Evaluates the given expression
f
with typeT
the given number oftimes
and stores the result in a scala.collection.immutable.ArraySeq.Example Usage
val result = repeat(15) { System.in.read() }
- times
The number of times the expression f
is evaluated. The
timesexpression is evaluated exactly once.
- f
An expression that is evaluated the given number of times unless an exception is thrown. Hence, even though
f
is not a by-name parameter, it behaves in the same way.- returns
The result of the evaluation of the expression
f
the given number of times stored in anIndexedSeq
. Iftimes
is zero an empty sequence is returned.
- Note
This is a macro.
- macro def fillIntArray(times: Int)(f: Int): ArraySeq[Int]
Evaluates the given expression
f
the given number oftimes
and stores the result in an scala.collection.immutable.ArraySeq[Int.Evaluates the given expression
f
the given number oftimes
and stores the result in an scala.collection.immutable.ArraySeq[Int.Example Usage
val result = fillIntArray(15) { System.in.readByte() }
- times
The number of times the expression
f
is evaluated. Thetimes
expression is evaluated exactly once.- f
An expression that is evaluated the given number of times unless an exception is thrown. Hence, even though
f
is not a by-name parameter, it behaves in the same way.- returns
The result of the evaluation of the expression
f
the given number of times stored in anIndexedSeq
. Iftimes
is zero an empty sequence is returned.
- Note
This is a macro.
- def find[T <: AnyRef](data: ArraySeq[T])(compareTo: (T) => Int): Option[T]
- def find[T <: AnyRef](data: ArraySeq[T], comparable: java.lang.Comparable[T]): Option[T]
Finds the value identified by the given comparator, if any.
Finds the value identified by the given comparator, if any.
- data
An array sorted in ascending order according to the test done by the comparator.
- comparable
A comparable which is used to search for the matching value. If the object matches multiple values, the returned value is not precisely specified.
- Note
The comparator has to be able to handle
,null
values if the given array may contain null values.The array must contain less than Int.MaxValue/2 values.
- final macro def forFirstN[T <: AnyRef](l: List[T], n: Int)(f: (T) => Unit): Unit
Executes the given function
f
for the firstn
values of the given list.Executes the given function
f
for the firstn
values of the given list. The behavior is undefined if the given list does not have at leastn
elements.- Note
This is a macro.
- final macro def foreachNonNullValue[T <: AnyRef](a: Array[T])(f: (Int, T) => Unit): Unit
Iterates over a given array
a
and calls the given functionf
for each non-null value in the array.Iterates over a given array
a
and calls the given functionf
for each non-null value in the array.- Note
This is a macro.
- final macro def foreachWithIndex[T <: AnyRef](a: Array[T])(f: (T, Int) => Unit): Unit
Allocation free, local iteration over all elements of an array.
Allocation free, local iteration over all elements of an array.
- Note
This is a macro.
- macro def iterateTo(from: Int, to: Int)(f: (Int) => Unit): Unit
Iterates over the given range of integer values
[from,to]
and calls the given function f for each value.Iterates over the given range of integer values
[from,to]
and calls the given function f for each value.If
from
is smaller or equal toto
,f
will not be called.- Note
This is a macro.
- macro def iterateUntil(from: Int, until: Int)(f: (Int) => Unit): Unit
Iterates over the given range of integer values
[from,until)
and calls the given function f for each value.Iterates over the given range of integer values
[from,until)
and calls the given function f for each value.If
from
is smaller thanuntil
,f
will not be called. - macro def repeat(times: Int)(f: Unit): Unit
Runs the given function f the given number of times.
- object Comparable
Factory for creating a
Comparable
based on a function that enables the (one-way) comparison with value of a specific type.