Class Diffs

All Implemented Interfaces:
Serializable, Cloneable, Map<String,Diffs>

public class Diffs extends LinkedHashMap<String,Diffs>
Used to report difference(s) between two hierarchical structures.

Each individual difference is a String (map key) and has optional further detail contained in another Diffs instance (map value, or null for none). Keys must not be null.

See Also:
  • Constructor Details

    • Diffs

      public Diffs()
      Default constructor.
    • Diffs

      public Diffs(Diffs other)
      Copy constructor. Performs a shallow copy.
      Parameters:
      other - instance to copy
  • Method Details

    • add

      public void add(String description)
      Add a difference without any sub-differences.
      Parameters:
      description - description of the difference
      Throws:
      IllegalArgumentException - if description is null
    • add

      public void add(String description, Diffs diffs)
      Add a difference with optional sub-differences.
      Parameters:
      description - description of the difference
      diffs - sub-differences, or null for none
      Throws:
      IllegalArgumentException - if description is null
    • toString

      public String toString()
      Format this instance as a String.
      Overrides:
      toString in class AbstractMap<String,Diffs>