Skip to content

cliffordfajardo/atom-java-snippets

Repository files navigation

Atom Java Snippets

A collection of Java commands for optimizing modern Java development productivity.

The MIT License apm apm

Install

apm install atom-java-snippets

Contributing/Suggestions

Feel free to let me know (link) what else can be improved/added or you can also submit a PR.

Snippets Overview

Snippets are optimized to be short and easy to remember. Some snippets are "chainable" and render differently when preceded by a ".".

  • [Control Flow](#Control Flow Snippets)
  • [Classes](#Class Related Snippets)
  • [Java Doc Comments](#Java Doc Comments Snippets)
  • Miscellaneous
  • [Return Values](#Returning Values Snippets)
  • [Types](#Type Snippets)

Control Flow Snippets

if⇥ if statement
if(${1:condition}) {
  ${2}
}$3
else⇥ else statement
else {
  ${1}
}$2
ifelse⇥ if else statement
if(${1:condition}) {
  ${2}
} else {
  ${3}
}$4
elseif⇥ else if statement
else if (${1:condition}) {
  ${2}
}${3}
for⇥ for loop
for (Integer ${1:i} = 0; ${1:i} < ${2:iterable}${3:.length}; ${1:i}++) {
  ${4}
}${5}
fore⇥ iterator based for each loop
for(${1:object_type} ${2:var_name}: ${3:collection_name}) {
  ${4:var_name}
}$5
while⇥ while loop
while (${1:condition}) {
  ${2}
}$3
trycatch⇥ try/catch
try {
  ${1}
} catch(Exception ${2:exception_name}) {
  ${2:exception_name}
}$3
tryfinally⇥ try/finally
try {
  ${1}
} finally {
  ${2}
}$3
trycatchfinally⇥ try/catch/finally
try {
  ${1}
} catch(Exception ${2:exception_name}) {
  ${2:exception_name}
} finally {
  ${3}
}${4}

Class Related Snippets

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

Java Doc Comments Snippets

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
*/

Miscellaneous

print⇥ System.out.println
System.out.println(${1});$2

Returning Values Snippets

r⇥ return
return ${1};${2}
rt⇥ return true
return true;
rf⇥ return false
return false;
rth⇥ return this
return this;
rn⇥ return null
return null;
r0⇥ return 0
return 0;
r1⇥ return 1
return -1;
r-1⇥ return -1
return -1;

Contact Me

Credits

  • Idleberg for his Atomizer package that helped me convert Sublime snippets into Atom's format.

About

A collection of Java snippets for Atom

Resources

License

MIT, MIT licenses found

Licenses found

MIT
license
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published