File tree Expand file tree Collapse file tree
samples/src/test/java/org/autorefactor/refactoring/rules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,7 +84,13 @@ public String replaceVectorWithLoop(List<Date> dates) {
8484 list .add (date );
8585 }
8686
87- return list .toString ();
87+ // Keep this comment too
88+ Vector <Date > secondList = new Vector <Date >();
89+ for (; list .isEmpty (); list .removeElementAt (0 )) {
90+ secondList .add (list .elementAt (0 ));
91+ }
92+
93+ return secondList .toString ();
8894 }
8995
9096 public void replaceVectorWithModifier () {
@@ -136,6 +142,7 @@ public void replaceOldMethod() {
136142 list .addElement (42 );
137143 list .elementAt (0 );
138144 list .copyInto (new Object [10 ]);
145+ list .copyInto (new Integer [10 ]);
139146 list .removeElement (123 );
140147 list .removeElementAt (1 );
141148 list .removeAllElements ();
@@ -154,7 +161,7 @@ public String doNotReplaceSpecificMethod() {
154161 return list .firstElement ();
155162 }
156163
157- public void replaceStackWithRunnable () {
164+ public void replaceVectorWithRunnable () {
158165 // Keep this comment
159166 final Vector <String > list = new Vector <String >();
160167 new Runnable () {
Original file line number Diff line number Diff line change @@ -84,7 +84,13 @@ public String replaceVectorWithLoop(List<Date> dates) {
8484 list .add (date );
8585 }
8686
87- return list .toString ();
87+ // Keep this comment too
88+ java .util .ArrayList <Date > secondList = new java .util .ArrayList <Date >();
89+ for (; list .isEmpty (); list .remove (0 )) {
90+ secondList .add (list .get (0 ));
91+ }
92+
93+ return secondList .toString ();
8894 }
8995
9096 public void replaceVectorWithModifier () {
@@ -136,6 +142,7 @@ public void replaceOldMethod() {
136142 list .add (42 );
137143 list .get (0 );
138144 list .toArray (new Object [10 ]);
145+ list .toArray (new Integer [10 ]);
139146 list .remove (123 );
140147 list .remove (1 );
141148 list .clear ();
@@ -154,7 +161,7 @@ public String doNotReplaceSpecificMethod() {
154161 return list .firstElement ();
155162 }
156163
157- public void replaceStackWithRunnable () {
164+ public void replaceVectorWithRunnable () {
158165 // Keep this comment
159166 final java .util .ArrayList <String > list = new java .util .ArrayList <String >();
160167 new Runnable () {
You can’t perform that action at this time.
0 commit comments