private int calculateSizeDiff(Object oldValues, Object newValues) {
    int oldSize = 0, newSize = 0;
    if (oldValues != null) {
      if (oldValues instanceof Collection) {
        // Its going to be subtracted.
        oldSize = -(((Collection) oldValues).size());
      } else {
        oldSize = -1;
      }
    }
    if (newValues != null) {
      if (newValues instanceof Collection) {
        // Its going to be added.
        newSize = (((Collection) newValues).size());
      } else {
        newSize = 1;
      }
    }
    return (oldSize + newSize);
  }
Create an Range Index that can be used when executing queries.

@param indexName the name of this index, used for statistics collection
@param indexedExpression the expression to index on, a function dependent on region entries
       individually.
@param fromClause expression that evaluates to the collection(s) that will be queried over,
       must contain one and only one region path.
@param projectionAttributes expression that transforms each element in the result set of a
       query Return the newly created Index
geode-core/src/main/java/org/apache/geode/cache/query/internal/index/RangeIndex.java