@@ -1558,24 +1558,29 @@ private static <T> T baseGetOrSetOrRemove(final Map<String, Object> object, fina
15581558 index += 1 ;
15591559 }
15601560 if (index > 0 && index == length ) {
1561- if (operationType == OperationType .SET ) {
1562- if (savedLocalObject instanceof Map ) {
1563- ((Map ) savedLocalObject ).put (savedPath , value );
1564- } else {
1565- ((List ) savedLocalObject ).set (Integer .parseInt (savedPath ), value );
1566- }
1567- } else if (operationType == OperationType .REMOVE ) {
1568- if (savedLocalObject instanceof Map ) {
1569- ((Map ) savedLocalObject ).remove (savedPath );
1570- } else {
1571- ((List ) savedLocalObject ).remove (Integer .parseInt (savedPath ));
1572- }
1573- }
1561+ checkSetAndRemove (value , operationType , savedLocalObject , savedPath );
15741562 return (T ) localObject ;
15751563 }
15761564 return null ;
15771565 }
15781566
1567+ private static void checkSetAndRemove (Object value , OperationType operationType , Object savedLocalObject ,
1568+ String savedPath ) {
1569+ if (operationType == OperationType .SET ) {
1570+ if (savedLocalObject instanceof Map ) {
1571+ ((Map ) savedLocalObject ).put (savedPath , value );
1572+ } else {
1573+ ((List ) savedLocalObject ).set (Integer .parseInt (savedPath ), value );
1574+ }
1575+ } else if (operationType == OperationType .REMOVE ) {
1576+ if (savedLocalObject instanceof Map ) {
1577+ ((Map ) savedLocalObject ).remove (savedPath );
1578+ } else {
1579+ ((List ) savedLocalObject ).remove (Integer .parseInt (savedPath ));
1580+ }
1581+ }
1582+ }
1583+
15791584 private static Map .Entry getMapEntry (Map map ) {
15801585 return map .isEmpty () ? null : (Map .Entry ) map .entrySet ().iterator ().next ();
15811586 }
0 commit comments