Generic Instance Method 総称体インスタンスメソッド

difference(from:by:)

Returns the difference needed to produce this collection’s ordered elements from the given collection, using the given predicate as an equivalence test. このコレクションのもつ順序付けられた要素をこの与えられたコレクションから生み出すために必要とされる差異を返します、与えられた述部を同等性試験として使います。

Declaration 宣言

func difference<C>(from other: C, by areEquivalent: (C.Element, UInt8) -> Bool) -> CollectionDifference<UInt8> where C : BidirectionalCollection, UInt8 == C.Element

Parameters パラメータ

other

The base state. 基準状態。

areEquivalent

A closure that returns a Boolean value indicating whether two elements are equivalent. あるクロージャ、それは2つの要素が等しいかどうかを指し示しているブール値を返します。

Return Value 戻り値

The difference needed to produce the receiver’s state from the parameter’s state. レシーバのもつ状態をパラメータのもつ状態から生成するのに必要とされる差異。

Discussion 議論

This function does not infer element moves. If you need to infer moves, call the inferringMoves() method on the resulting difference. この関数は、要素の移動を推論しません。あなたが移動を推論する必要があるならば、inferringMoves()メソッドを結果の差異の上で呼び出してください。

Complexity: Worst case performance is O(n * m), where n is the count of this collection and m is other.count. You can expect faster execution when the collections share many common elements. 計算量:最悪の場合の性能は、O(n * m)です、ここでnはこのコレクションの総数です、そしてmother.countです。あなたは、コレクションが多くの共通する要素を共有する時は、より速い遂行を期待できます。