Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.multithreading-in-java-mhtck</groupId>
<artifactId>multithreading</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>multithreading-in-java-mhtck</name>
</project>
11 changes: 11 additions & 0 deletions src/main/java/multithreading/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package multithreading;

public class Application {

public static void main(String[] args) {

multithreading.Job jop = new multithreading.Job();
jop.run();
}

}
27 changes: 27 additions & 0 deletions src/main/java/multithreading/Job.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package multithreading;

import java.util.Arrays;
import java.util.List;

public class Job {

private final List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6);

public void run() {
theLambdaThread();
}

public void theLambdaThread() {
new Thread(() -> {
for (Integer i : numbers) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("Lambda Thread: "+ i);
}
}).start();
}

}