Is there any shortcut in Eclipse that allows me to add a field to the argument list of an existing constructor?
Example:
I hava this class:
public class A {
int a;
int b;
public A(int a, int b) {
this.a = a;
this.b = b;
}
}
when i add a field int c
(or many fields) i want to add it to the argumentlist of the constructor and assign the parameter to the field:
public class A {
int a;
int b;
int c; //this is new
public A(int a, int b, int c) {
this.a = a;
this.b = b;
this.c = c;
}
}
i currently do this by creating the parameter manually and then press CTRL + 1
and then choose "assign parameter to field"
but if i add more than one field at once this isn't really a good solution imho.
I don't want to create a new constructor!