sizeCompare
方法(或屬性)屬於 scala.collection.View.ZipWithIndex
類(class),其相關用法說明如下。
用法 一
def sizeCompare(that: Iterable[_]): Int
將此可迭代集合的大小與另一個 Iterable
的大小進行比較.
值參數:
- that
Iterable
的大小與此可迭代集合的大小進行比較.
返回:
一個值
x
其中x < 0 if this.size < that.size x == 0 if this.size == that.size x > 0 if this.size > that.size
這裏實現的方法不直接調用
size
;它的運行時間是O(this.size min that.size)
而不是O(this.size + that.size)
。如果計算size
很便宜並且knownSize
返回-1
,則應該重寫該方法。繼承自:
- IterableOps
源碼:
- Iterable.scala
用法 二
def sizeCompare(otherSize: Int): Int
將此可迭代集合的大小與測試值進行比較。
值參數:
- otherSize
與大小進行比較的測試值。
返回:
一個值
x
其中x < 0 if this.size < otherSize x == 0 if this.size == otherSize x > 0 if this.size > otherSize
這裏實現的方法不直接調用
size
;它的運行時間是O(size min otherSize)
而不是O(size)
。如果計算size
很便宜並且knownSize
返回-1
,則應該重寫該方法。也可以看看:
繼承自:
- collection.IterableOps.sizeCompare
源碼:
- Iterable.scala
相關用法
- Scala ZipWithIndex.sizeIs用法及代碼示例
- Scala ZipWithIndex.scanRight用法及代碼示例
- Scala ZipWithIndex.sliding用法及代碼示例
- Scala ZipWithIndex.inits用法及代碼示例
- Scala ZipWithIndex.partitionMap用法及代碼示例
- Scala ZipWithIndex.transpose用法及代碼示例
- Scala ZipWithIndex.groupMap用法及代碼示例
- Scala ZipWithIndex.tails用法及代碼示例
- Scala ZipWithIndex.lazyZip用法及代碼示例
- Scala ZipWithIndex.unzip3用法及代碼示例
- Scala ZipWithIndex.collectFirst用法及代碼示例
- Scala ZipWithIndex.addString用法及代碼示例
- Scala ZipWithIndex.groupBy用法及代碼示例
- Scala ZipWithIndex.mkString用法及代碼示例
- Scala ZipWithIndex.unzip用法及代碼示例
- Scala ZipWithIndex.groupMapReduce用法及代碼示例
- Scala ZippedIterable2.unzip用法及代碼示例
- Scala ZippedIterable2.addString用法及代碼示例
- Scala ZipAll.groupBy用法及代碼示例
- Scala ZippedIterable3.transpose用法及代碼示例
- Scala ZipAll.unzip用法及代碼示例
- Scala ZippedIterable3.inits用法及代碼示例
- Scala Zip.transpose用法及代碼示例
- Scala ZipAll.addString用法及代碼示例
- Scala ZipAll.inits用法及代碼示例
注:本文由純淨天空篩選整理自scala-lang.org大神的英文原創作品 ZipWithIndex.sizeCompare。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。