JSONObject toRest(ParseEncoder encoder){
  State state;
  List<ParseOperationSet> operationSetQueueCopy;
synchronized (mutex) {
    state=getState();
    int operationSetQueueSize=operationSetQueue.size();
    operationSetQueueCopy=new ArrayList<>(operationSetQueueSize);
    for (int i=0; i < operationSetQueueSize; i++) {
      ParseOperationSet original=operationSetQueue.get(i);
      ParseOperationSet copy=new ParseOperationSet(original);
      operationSetQueueCopy.add(copy);
    }
  }
  return toRest(state,operationSetQueueCopy,encoder);
}

JSONObject toRest ( ParseEncoder encoder ) { State state ; List < ParseOperationSet > operationSetQueueCopy ; synchronized ( mutex ) { state = getState ( ) ; int operationSetQueueSize = operationSetQueue . size ( ) ; operationSetQueueCopy = new ArrayList < > ( operationSetQueueSize ) ; for ( int i = 0 ; i < operationSetQueueSize ; i ++ ) { ParseOperationSet original = operationSetQueue . get ( i ) ; ParseOperationSet copy = new ParseOperationSet ( original ) ; operationSetQueueCopy . add ( copy ) ; } } return toRest ( state , operationSetQueueCopy , encoder ) ; }
convert to rest json for persisting in lds .
