A collection of Java commands for optimizing modern Java development productivity.
apm install atom-java-snippets
Feel free to let me know (link) what else can be improved/added or you can also submit a PR.
Snippets are optimized to be short and easy to remember. Some snippets are "chainable" and render differently when preceded by a ".".
if⇥
if statementif(${1:condition}) {
${2}
}$3
else⇥
else statementelse {
${1}
}$2
ifelse⇥
if else statementif(${1:condition}) {
${2}
} else {
${3}
}$4
elseif⇥
else if statementelse if (${1:condition}) {
${2}
}${3}
for⇥
for loopfor (Integer ${1:i} = 0; ${1:i} < ${2:iterable}${3:.length}; ${1:i}++) {
${4}
}${5}
fore⇥
iterator based for each loopfor(${1:object_type} ${2:var_name}: ${3:collection_name}) {
${4:var_name}
}$5
while⇥
while loopwhile (${1:condition}) {
${2}
}$3
trycatch⇥
try/catchtry {
${1}
} catch(Exception ${2:exception_name}) {
${2:exception_name}
}$3
tryfinally⇥
try/finallytry {
${1}
} finally {
${2}
}$3
trycatchfinally⇥
try/catch/finallytry {
${1}
} catch(Exception ${2:exception_name}) {
${2:exception_name}
} finally {
${3}
}${4}
class
class and constructor${1:public} class ${2:ClassName} {
${0}
}$0
classAndConstructor⇥
class and constructor${1:public_or_private} class ${2:ClassName} {
${3:public_or_private} ${2:ClassName} (${4:Parameters}) {
${5}
}
}
constructorPublic⇥
public class constructor${1:public} ${2:ClassName} (${3:Parameters}) {
${4}
}$5
constructorPrivate⇥
private class constructor${1:private} ${2:ClassName} (${3:Parameters}) {
${4}
}$5
methodPublic⇥
public method${1:public} ${2:ClassName} (${3:Parameters}) {
${4}
}$5
methodPrivate⇥
private method${1:private} ${2:ClassName} (${3:Parameters}) {
${4}
}$5
methodStatic⇥
static method${1:public_or_private} static ${2:ClassName} (${3:Parameters}) {
${4}
}$5
commentMethod⇥
java doc method comment/**
* @description your_method_description
* @param param_name your_param_description
* @return return_type your_return_description
**/$1
commentModule⇥
java doc module comment/**
* The ____ program implements/is used for.....
*
* @author
*/
print⇥
System.out.printlnSystem.out.println(${1});$2
r⇥
returnreturn ${1};${2}
rt⇥
return truereturn true;
rf⇥
return falsereturn false;
rth⇥
return thisreturn this;
rn⇥
return nullreturn null;
r0⇥
return 0return 0;
r1⇥
return 1return -1;
r-1⇥
return -1return -1;