boiling memoir

journey of one man

Refactor Inline Condition Assignment in While Loops

I wish IDE’s would offer refactoring to convert something like:

int len;
while ((len = read()) > 0) {
// business operation
}
into
int len = read(); 
while (len > 0) {
// business operation
len = read();
}
Nowadays I don’t think the inline modification bothers me as much as before but I still like to have the option of easily refactor it with a click of the button (or keyboard).