sizeCompare
方法(或屬性)屬於 scala.collection.View.Appended
類(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 Appended.sizeIs用法及代碼示例
- Scala Appended.sortWith用法及代碼示例
- Scala Appended.sortBy用法及代碼示例
- Scala Appended.sliding用法及代碼示例
- Scala Appended.scanRight用法及代碼示例
- Scala Appended.lengthCompare用法及代碼示例
- Scala Appended.partitionMap用法及代碼示例
- Scala Appended.permutations用法及代碼示例
- Scala Appended.groupBy用法及代碼示例
- Scala Appended.addString用法及代碼示例
- Scala Appended.combinations用法及代碼示例
- Scala Appended.transpose用法及代碼示例
- Scala Appended.unzip用法及代碼示例
- Scala Appended.collectFirst用法及代碼示例
- Scala Appended.inits用法及代碼示例
- Scala Appended.mkString用法及代碼示例
- Scala Appended.tails用法及代碼示例
- Scala Appended.unzip3用法及代碼示例
- Scala Appended.groupMapReduce用法及代碼示例
- Scala Appended.lengthIs用法及代碼示例
- Scala Appended.groupMap用法及代碼示例
- Scala Appended.lazyZip用法及代碼示例
- Scala ApplyMethods.args用法及代碼示例
- Scala ApplyMethods.fun用法及代碼示例
- Scala ArrayBuffer.inits用法及代碼示例
注:本文由純淨天空篩選整理自scala-lang.org大神的英文原創作品 Appended.sizeCompare。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。