-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #675 from tpenn/java-functions
Java functions
- Loading branch information
Showing
3 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"meta": { | ||
"language": "java", | ||
"language_version": "11", | ||
"language_name": "Java", | ||
"structure": "functions" | ||
}, | ||
"concepts": { | ||
"void_function_no_parameters": { | ||
"code": "void methodName()\n{\n\t//code\n}", | ||
"name": "Method that does not return a value and takes no parameters" | ||
}, | ||
"void_function_with_parameters": { | ||
"code": "void methodName(parameterType1 parameterName1, parameterType2 parameterName2)\n{\n\t//code\n}", | ||
"name": "Method that does not return a value and that takes 1 or more defined parameters" | ||
}, | ||
"void_function_variable_parameters": { | ||
"code": "void methodName(parameterType... parameterName)\n{\n\t//code\n}", | ||
"name": "Method that does not return a value and takes a variable number of parameters" | ||
}, | ||
"return_value_function_no_parameters": { | ||
"code": "returnValueType methodName()\n{\n\t//code\n\treturn returnValue;\n}", | ||
"name": "Method that returns a value and takes no parameters" | ||
}, | ||
"return_value_function_with_parameters": { | ||
"code": "returnValueType methodName(parameterType1 parameterName1, parameterType2 parameterName2)\n{\n\t//code\n\treturn returnValue;\n}", | ||
"name": "Method that returns a value and takes 1 or more defined parameters" | ||
}, | ||
"return_value_function_variable_parameters": { | ||
"name": "Method that returns a value and takes a variable number of parameters", | ||
"code": "returnValueType methodName(parameterType... parameterName)\n{\n\t//code\n\treturn returnValue;\n}" | ||
}, | ||
"anonymous_function_no_parameters": { | ||
"name": "Anonymous function that takes no parameters", | ||
"code": "() -> //single line of code\n\n() ->\n{\n\t//multiple lines of code\n}" | ||
}, | ||
"anonymous_function_with_parameters": { | ||
"name": "Anonymous function that takes 1 or more defined parameters", | ||
"code": "(parameterName1, parameterName2) ->\n{\n\t//code\n}" | ||
}, | ||
"anonymous_function_no_parameters_with_return": { | ||
"name": "Anonymous function that takes no parameters and returns a value", | ||
"code": "() -> //single line expression/value\n\n() ->\n{\n\t//multiple lines of code\n\treturn returnValue;\n}" | ||
}, | ||
"anonymous_function_with_parameters_with_return": { | ||
"name": "Anonymous function that takes 1 or more defined parameters and returns a value", | ||
"code": "(parameterName1, parameterName2) ->\n{\n\t//code\n\treturn returnValue;\n}" | ||
}, | ||
"call_subroutine": { | ||
"name": "Call subroutine", | ||
"code": "MyClass x = new MyClass();\nx.subRoutine();" | ||
}, | ||
"return_from_subroutine": { | ||
"name": "Return from subroutine", | ||
"code": "MyClass x = new MyClass();\nsubRoutineReturnType y = x.subRoutine();" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"meta": { | ||
"language": "java", | ||
"language_version": "15", | ||
"language_name": "Java", | ||
"structure": "functions" | ||
}, | ||
"concepts": { | ||
"void_function_no_parameters": { | ||
"code": "void methodName()\n{\n\t//code\n}", | ||
"name": "Method that does not return a value and takes no parameters" | ||
}, | ||
"void_function_with_parameters": { | ||
"code": "void methodName(parameterType1 parameterName1, parameterType2 parameterName2)\n{\n\t//code\n}", | ||
"name": "Method that does not return a value and that takes 1 or more defined parameters" | ||
}, | ||
"void_function_variable_parameters": { | ||
"code": "void methodName(parameterType... parameterName)\n{\n\t//code\n}", | ||
"name": "Method that does not return a value and takes a variable number of parameters" | ||
}, | ||
"return_value_function_no_parameters": { | ||
"code": "returnValueType methodName()\n{\n\t//code\n\treturn returnValue;\n}", | ||
"name": "Method that returns a value and takes no parameters" | ||
}, | ||
"return_value_function_with_parameters": { | ||
"code": "returnValueType methodName(parameterType1 parameterName1, parameterType2 parameterName2)\n{\n\t//code\n\treturn returnValue;\n}", | ||
"name": "Method that returns a value and takes 1 or more defined parameters" | ||
}, | ||
"return_value_function_variable_parameters": { | ||
"name": "Method that returns a value and takes a variable number of parameters", | ||
"code": "returnValueType methodName(parameterType... parameterName)\n{\n\t//code\n\treturn returnValue;\n}" | ||
}, | ||
"anonymous_function_no_parameters": { | ||
"name": "Anonymous function that takes no parameters", | ||
"code": "() -> //single line of code\n\n() ->\n{\n\t//multiple lines of code\n}" | ||
}, | ||
"anonymous_function_with_parameters": { | ||
"name": "Anonymous function that takes 1 or more defined parameters", | ||
"code": "(parameterName1, parameterName2) ->\n{\n\t//code\n}" | ||
}, | ||
"anonymous_function_no_parameters_with_return": { | ||
"name": "Anonymous function that takes no parameters and returns a value", | ||
"code": "() -> //single line expression/value\n\n() ->\n{\n\t//multiple lines of code\n\treturn returnValue;\n}" | ||
}, | ||
"anonymous_function_with_parameters_with_return": { | ||
"name": "Anonymous function that takes 1 or more defined parameters and returns a value", | ||
"code": "(parameterName1, parameterName2) ->\n{\n\t//code\n\treturn returnValue;\n}" | ||
}, | ||
"call_subroutine": { | ||
"name": "Call subroutine", | ||
"code": "MyClass x = new MyClass();\nx.subRoutine();" | ||
}, | ||
"return_from_subroutine": { | ||
"name": "Return from subroutine", | ||
"code": "MyClass x = new MyClass();\nsubRoutineReturnType y = x.subRoutine();" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"meta": { | ||
"language": "java", | ||
"language_version": "17", | ||
"language_name": "Java", | ||
"structure": "functions" | ||
}, | ||
"concepts": { | ||
"void_function_no_parameters": { | ||
"code": "void methodName()\n{\n\t//code\n}", | ||
"name": "Method that does not return a value and takes no parameters" | ||
}, | ||
"void_function_with_parameters": { | ||
"code": "void methodName(parameterType1 parameterName1, parameterType2 parameterName2)\n{\n\t//code\n}", | ||
"name": "Method that does not return a value and that takes 1 or more defined parameters" | ||
}, | ||
"void_function_variable_parameters": { | ||
"code": "void methodName(parameterType... parameterName)\n{\n\t//code\n}", | ||
"name": "Method that does not return a value and takes a variable number of parameters" | ||
}, | ||
"return_value_function_no_parameters": { | ||
"code": "returnValueType methodName()\n{\n\t//code\n\treturn returnValue;\n}", | ||
"name": "Method that returns a value and takes no parameters" | ||
}, | ||
"return_value_function_with_parameters": { | ||
"code": "returnValueType methodName(parameterType1 parameterName1, parameterType2 parameterName2)\n{\n\t//code\n\treturn returnValue;\n}", | ||
"name": "Method that returns a value and takes 1 or more defined parameters" | ||
}, | ||
"return_value_function_variable_parameters": { | ||
"name": "Method that returns a value and takes a variable number of parameters", | ||
"code": "returnValueType methodName(parameterType... parameterName)\n{\n\t//code\n\treturn returnValue;\n}" | ||
}, | ||
"anonymous_function_no_parameters": { | ||
"name": "Anonymous function that takes no parameters", | ||
"code": "() -> //single line of code\n\n() ->\n{\n\t//multiple lines of code\n}" | ||
}, | ||
"anonymous_function_with_parameters": { | ||
"name": "Anonymous function that takes 1 or more defined parameters", | ||
"code": "(parameterName1, parameterName2) ->\n{\n\t//code\n}" | ||
}, | ||
"anonymous_function_no_parameters_with_return": { | ||
"name": "Anonymous function that takes no parameters and returns a value", | ||
"code": "() -> //single line expression/value\n\n() ->\n{\n\t//multiple lines of code\n\treturn returnValue;\n}" | ||
}, | ||
"anonymous_function_with_parameters_with_return": { | ||
"name": "Anonymous function that takes 1 or more defined parameters and returns a value", | ||
"code": "(parameterName1, parameterName2) ->\n{\n\t//code\n\treturn returnValue;\n}" | ||
}, | ||
"call_subroutine": { | ||
"name": "Call subroutine", | ||
"code": "MyClass x = new MyClass();\nx.subRoutine();" | ||
}, | ||
"return_from_subroutine": { | ||
"name": "Return from subroutine", | ||
"code": "MyClass x = new MyClass();\nsubRoutineReturnType y = x.subRoutine();" | ||
} | ||
} | ||
} |