forked from Labore/PR2-L
1
0
Fork 0

add BifunctionDemo

main
Gerd Marmitt 2025-05-13 18:07:57 +02:00
parent 4d0db08a3c
commit 6a276dba76
4 changed files with 50 additions and 0 deletions

7
.vscode/launch.json vendored
View File

@ -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",

View File

@ -0,0 +1,7 @@
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}

View File

@ -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).

View File

@ -0,0 +1,18 @@
import java.util.function.BiFunction;
public class BiFunctionDemo {
public static void main(String args[])
{
BiFunction<Integer, Integer, Integer> composite1 = (a, b) -> a + b;
composite1 = composite1.andThen(a -> 2 * a);
System.out.println("Composite1 = " + composite1.apply(2, 3));
BiFunction<Integer, Integer, Integer> composite2 = (a, b) -> a * b;
composite2 = composite2.andThen(a -> 3 * a);
System.out.println("Composite2 = " + composite2.apply(2, 3));
}
}