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, Base.Element) -> Bool) -> CollectionDifference<Base.Element> where C : BidirectionalCollection, Base.Element == 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です。あなたはより速い遂行を予想できます、コレクションそれらが多くの普通の要素を共有する場合は。