Skip to content
This repository was archived by the owner on Aug 8, 2020. It is now read-only.
Sebastian Gröbler edited this page Nov 16, 2013 · 5 revisions

What happens if there are cylces in the object graph?

In case you try to diff a graph that contains cycles the Differ will end up throwing an OutOfMemoryError. There is no cycle detection logic implemented, thus avoiding cycles is in the responsibility of the client. There are basically two ways to avoid cycles:

  1. Cut the cycle by excluding a property that is part of the reference cycle and diff the objects below the "cut" in a separate call.
  2. Cut the cycle by providing a CheckableSerializer implementation for a property type that is part of the reference cylce.

How are Lists serialized?

Lists are sorted by either a provided naturally ordered class (implements Comparable) or a comparator and then serialized with an index like this:

...
+SomeList[0]='serializedValue'
+SomeList[1]='someOtherSerializedValue'
...

How are Maps serialized?

Maps are sorted by either a provided naturally ordered class (implements Comparable) or a comparator. A sorted map is a map that is sorted by it's keys.

Example:

...
+SomeMap['someSerializedMapKey']='someSerializedMapValue'
+SomeMap['someOtherSerializedMapKey']='someOtherSerializedMapValue'
...
[Home](https://github.com/codereligion/diff/wiki/)
[Usage](https://github.com/codereligion/diff/wiki/Usage)
[FAQ](https://github.com/codereligion/diff/wiki/FAQ)

Clone this wiki locally