# Diff

@Serializable
data class Diff < T >(val removed: List <@Serializable(with = IndexedValueSerializer::class ) IndexedValue < T >>, val replaced: List < Pair <@Serializable(with = IndexedValueSerializer::class ) IndexedValue < T >, @Serializable(with = IndexedValueSerializer::class ) IndexedValue < T >>>, val added: List <@Serializable(with = IndexedValueSerializer::class ) IndexedValue < T >>)(source)

Diff object which contains information about differences between two Iterables

See tests for more info

#### Parameters

removed

The objects which has been presented in the old collection but absent in new one. Index here is the index in the old collection

added

The object which appear in new collection only. Indexes here show the index in the new collection

replaced

Pair of old-new changes. First object has been presented in the old collection on its IndexedValue.index place, the second one is the object in new collection. Both have indexes due to the fact that in case when some value has been replaced after adds or removes in original collection the object index will be changed

#### See also

calculateDiff

## Constructors

Diff
Link copied to clipboard
constructor(removed: List <@Serializable(with = IndexedValueSerializer::class ) IndexedValue < T >>, replaced: List < Pair <@Serializable(with = IndexedValueSerializer::class ) IndexedValue < T >, @Serializable(with = IndexedValueSerializer::class ) IndexedValue < T >>>, added: List <@Serializable(with = IndexedValueSerializer::class ) IndexedValue < T >>)

## Types

Companion
Link copied to clipboard
object Companion

## Properties

added
Link copied to clipboard
val added : List <@Serializable(with = IndexedValueSerializer::class ) IndexedValue < T >>
removed
Link copied to clipboard
val removed : List <@Serializable(with = IndexedValueSerializer::class ) IndexedValue < T >>
replaced
Link copied to clipboard
val replaced : List < Pair <@Serializable(with = IndexedValueSerializer::class ) IndexedValue < T >, @Serializable(with = IndexedValueSerializer::class ) IndexedValue < T >>>

Old-New values pairs

## Functions

isEmpty
Link copied to clipboard
fun isEmpty (): Boolean
reversed
Link copied to clipboard
fun < T > Diff < T >. reversed (): Diff < T >

Reverse this. Result will contain Diff.added on Diff.removed (and vice-verse), all the Diff.replaced values will be reversed too