diff --git a/src/src.iml b/src/src.iml new file mode 100644 index 0000000..37cc804 --- /dev/null +++ b/src/src.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/src/Break.java b/src/src/Break.java new file mode 100644 index 0000000..59ee15c --- /dev/null +++ b/src/src/Break.java @@ -0,0 +1,11 @@ +/** + * Created by PC on 07.06.2017. + */ +public class Break { + public static void main(String[] args) { + label1: for (int i = 0; i < 10; i++) { + if (i == 5) break label1; + System.out.println(i); + } + } +} diff --git a/src/src/Continue.java b/src/src/Continue.java new file mode 100644 index 0000000..aac4fb8 --- /dev/null +++ b/src/src/Continue.java @@ -0,0 +1,15 @@ +/** + * Created by PC on 07.06.2017. + */ +public class Continue { + public static void main(String[] args) { + int i = 0; + label1: + while (i < 10) { + i++; + System.out.println("Hello"); + if (i == 5) continue label1; + System.out.println("World"); + } + } +} diff --git a/src/src/DoWhile.java b/src/src/DoWhile.java new file mode 100644 index 0000000..6f2825e --- /dev/null +++ b/src/src/DoWhile.java @@ -0,0 +1,9 @@ +/** + * Created by PC on 07.06.2017. + */ +public class DoWhile { + public static void main(String[] args) { + int i = 0; + do {System.out.println(i++);}while (i < 10); + } +} diff --git a/src/src/For.java b/src/src/For.java new file mode 100644 index 0000000..b217dae --- /dev/null +++ b/src/src/For.java @@ -0,0 +1,10 @@ +/** + * Created by PC on 07.06.2017. + */ +public class For { + public static void main(String[] args) { + for (int i = 0; i < 10; i++) { + System.out.println(i); + } + } +} diff --git a/src/src/ForEach.java b/src/src/ForEach.java new file mode 100644 index 0000000..fbf59ed --- /dev/null +++ b/src/src/ForEach.java @@ -0,0 +1,17 @@ +import java.util.Arrays; +import java.util.List; + +/** + * Created by PC on 07.06.2017. + */ +public class ForEach { + public static void main(String[] args) { + List list = Arrays.asList(7, 10, 1, 5, 2); + list.forEach(item -> System.out.println(String.format("%s, %s, %s",item,list.indexOf(item), + list.toString()))); + System.out.println(); + list.forEach(System.out::print); + System.out.println(); + list.forEach(x -> System.out.print(x)); + } +} diff --git a/src/src/ForOf.java b/src/src/ForOf.java new file mode 100644 index 0000000..289cc7f --- /dev/null +++ b/src/src/ForOf.java @@ -0,0 +1,11 @@ +/** + * Created by PC on 07.06.2017. + */ +public class ForOf { + public static void main(String[] args) { + for (int elem: new int[]{7, 10, 1, 5, 2}) + { + System.out.println(elem); + } + } +} diff --git a/src/src/Map.java b/src/src/Map.java new file mode 100644 index 0000000..c0a0ecd --- /dev/null +++ b/src/src/Map.java @@ -0,0 +1,11 @@ +import java.util.Arrays; +import java.util.function.Function; + +/** + * Created by PC on 07.06.2017. + */ +public class Map { + public static void main(String[] args) { + Arrays.stream(new Integer[]{7, 10, 1, 5, 2}).map(x -> x * 2).forEach(System.out::println); + } +} diff --git a/src/src/While.java b/src/src/While.java new file mode 100644 index 0000000..7ada414 --- /dev/null +++ b/src/src/While.java @@ -0,0 +1,13 @@ +/** + * Created by PC on 07.06.2017. + */ +public class While { + public static void main(String[] args) { + int i = 0; + while (i<10) + { + System.out.println(i); + i++; + } + } +}