src/java/org/apache/cassandra/utils/MerkleTree.java
/**
     * @param ltree First tree.
     * @param rtree Second tree.
     * @return A list of the largest contiguous ranges where the given trees disagree.
     */
@param ltree First tree.
@param rtree Second tree.
@return A list of the largest contiguous ranges where the given trees disagree.
@param ltree First tree . @param rtree Second tree . @return A list of the largest contiguous ranges where the given trees disagree .
public static List<TreeRange> difference(MerkleTree ltree, MerkleTree rtree)
    {
        if (!ltree.fullRange.equals(rtree.fullRange))
            throw new IllegalArgumentException("Difference only make sense on tree covering the same range (but " + ltree.fullRange + " != " + rtree.fullRange + ")");
        List<TreeRange> diff = new ArrayList<TreeRange>();
        TreeRange active = new TreeRange(null, ltree.fullRange.left, ltree.fullRange.right, (byte)0, null);
        byte[] lhash = ltree.hash(active);
        byte[] rhash = rtree.hash(active);
        if (lhash != null && rhash != null && !Arrays.equals(lhash, rhash))
        {
            if (FULLY_INCONSISTENT == differenceHelper(ltree, rtree, diff, active))
                diff.add(active);
        }
        else if (lhash == null || rhash == null)
            diff.add(active);
        return diff;
    }
public static List < TreeRange > difference ( MerkleTree ltree , MerkleTree rtree ) { if ( ! ltree . fullRange . equals ( rtree . fullRange ) ) throw new IllegalArgumentException ( "Difference only make sense on tree covering the same range (but " + ltree . fullRange + " != " + rtree . fullRange + ")" ) ; List < TreeRange > diff = new ArrayList < TreeRange > ( ) ; TreeRange active = new TreeRange ( null , ltree . fullRange . left , ltree . fullRange . right , ( byte ) 0 , null ) ; byte [ ] lhash = ltree . hash ( active ) ; byte [ ] rhash = rtree . hash ( active ) ; if ( lhash != null && rhash != null && ! Arrays . equals ( lhash , rhash ) ) { if ( FULLY_INCONSISTENT == differenceHelper ( ltree , rtree , diff , active ) ) diff . add ( active ) ; } else if ( lhash == null || rhash == null ) diff . add ( active ) ; return diff ; }
@param ltree First tree.
@param ltree First tree .