These are the
current quick assist as of I20041002 (3.1 M3)
| Name |
Code example |
Invocation location |
||
|---|---|---|---|---|
| Inverse if statement |
if (x) a();
else b(); |
> | if (!x) b(); else a(); | on 'if' statements with 'else'
block |
| Inverse boolean expression |
a &&
!b |
> | !a || b | on a boolean expression |
| Remove extra parentheses |
if ((a == b) && (c != d) {} | > | if (a == b && c != d) {} | on selected expressions |
| Add paranoidal parentheses |
if (a == b && c != d) {} | > | if ((a == b) && (c != d) | on selected expressions |
| Join nested if statements |
if (a) { if (b) {} } | > | if (a && b) {} | on a nested if statement |
| Swap nested if statements | if (a) { if (b) {} } | > | if (b) { if (a) {} } | on a nested if statement |
| Split if statement with and'ed
expression |
if (a
&& b) {} |
> | if (a) { if (b) {} } | on an and'ed expression in a 'if' |
| Split if statement with or'd expression | if (a || b)
x(); |
> | if (a) x(); if(b) x(); | on an or'd expression in a 'if' |
| Inverse conditional expression |
x ? b : c | > | !x ? c : b | on a conditional expression |
| If-else assignment to
conditional expression |
if (a) x= 1;
else x = 2; |
> | x= a ? 1 : 2; | on an 'if' statement |
| If-else return to conditional expression | if (a) return 1; else return 2; | > | return a ? 1 : 2; | on an 'if' statement |
| Conditional expression assignment to If-else | x= a ? 1 : 2; | > | if (a) x= 1; else x = 2; | on a conditional expression |
| Conditional expression return to If-else | return a ? 1 : 2; | > | if (a) return 1; else return 2; | on a conditional expression |
| Exchange operands |
a + b |
> | b + a | on an infix operation |
| Cast and assign |
if (obj
instanceof Vector) { } |
> | if (obj instanceof Vector) { Vector vec= (Vector) obj; } |
on a instanceof expression in an 'if' or 'while' statement |
| Pick out string |
"abcdefgh" |
"abc" + "de" + "fgh" | select a part of a string literal |
|
| Split variable |
int i= 0; |
> | int i; i= 0; | On a variable with initialization |
| Join variable |
int i; i= 0; | > | int i= 0 | On a variable without
initialization |
| Assign to variable |
foo() |
> | X x= foo(); | On an expression statement |
| Assign parameter to field |
public A(int
color) {} |
> | Color fColor; public A(int color) { fColor= color; } |
On a parameter |
| Add finally block |
try { } catch (Expression e) { } |
> | try { } catch (Expression e) { } finally {} |
On a try/catch statement |
| Add else block |
if (a) b(); |
> | if (a) b(); else { } | On a if statement |
| Replace statement with block |
f (a) b(); |
> | if (a) { b(); } | On a if statement |
| Invert equals |
a.equals(b) |
> | b.equals(a) | On a invocation of 'equals' |
| Array initializer to Array
creation |
int[] i= { 1, 2, 3 } | > | int[] i= new int[] { 1, 2, 3 } | On an array initializer |
| Convert to 'enhanced for loop'
(JDK 5.0) |
for (Iterator
i= c.iterator();i.hasNext();) { } |
> | for (x : c) { } |
On a for loop |
| Create method in super class |
On a method declaration |
|||
| Unwrap blocks |
{ a() } |
> | a() | On blocks, if/while/for
statements |
| Rename in file |
On identifiers |
|||