diff --git a/.vscode/launch.json b/.vscode/launch.json index a688861..b1ee29f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,13 @@ // Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { + "type": "java", + "name": "BiFunctionDemo", + "request": "launch", + "mainClass": "BiFunctionDemo", + "projectName": "PR2-L_232be59f" + }, { "type": "java", "name": "CollectionsDemo", diff --git a/BifunctionDemo/.vscode/settings.json b/BifunctionDemo/.vscode/settings.json new file mode 100644 index 0000000..0ac215c --- /dev/null +++ b/BifunctionDemo/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "java.project.sourcePaths": ["src"], + "java.project.outputPath": "bin", + "java.project.referencedLibraries": [ + "lib/**/*.jar" + ] +} diff --git a/BifunctionDemo/README.md b/BifunctionDemo/README.md new file mode 100644 index 0000000..a43b9f6 --- /dev/null +++ b/BifunctionDemo/README.md @@ -0,0 +1,18 @@ +## Getting Started + +Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code. + +## Folder Structure + +The workspace contains two folders by default, where: + +- `src`: the folder to maintain sources +- `lib`: the folder to maintain dependencies + +Meanwhile, the compiled output files will be generated in the `bin` folder by default. + +> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there. + +## Dependency Management + +The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies). diff --git a/BifunctionDemo/src/BiFunctionDemo.java b/BifunctionDemo/src/BiFunctionDemo.java new file mode 100644 index 0000000..ceb07cb --- /dev/null +++ b/BifunctionDemo/src/BiFunctionDemo.java @@ -0,0 +1,18 @@ +import java.util.function.BiFunction; + +public class BiFunctionDemo { + public static void main(String args[]) + { + BiFunction composite1 = (a, b) -> a + b; + + composite1 = composite1.andThen(a -> 2 * a); + + System.out.println("Composite1 = " + composite1.apply(2, 3)); + + BiFunction composite2 = (a, b) -> a * b; + + composite2 = composite2.andThen(a -> 3 * a); + + System.out.println("Composite2 = " + composite2.apply(2, 3)); + } +}