Use of the extract method operation programatically

I would like to extract a unique method from the two following methods since they have equivalent bodies :

public void m(){
   System.out.print("Hello");
}

public void n(){
   System.out.print("Hello");
}


So, I like to get the following result:

public void m(){
   myextractedMethod();
}


public void myextractedMethod(){
   System.out.print("Hello");
}

public void n(){
   myextractedMethod();
}


I already suceeded only with one method at the same time but I would like to know if there is an option which allows to me to get the above result.

1 comment
Comment actions Permalink

Hello,

You should call to ExtractMethodHandler and it would replace duplicates automatically for you inside. In order to get more details you should provide the context where you try to invoke extrace programmatically yourself.
Thanks

0

Please sign in to leave a comment.