|
1 | 1 | Some Text |
2 | 2 | Some Text that will be saved |
3 | 3 | A lot of Text Present in here |
4 | | - |
5 | | -Extra texts from readme.md file |
6 | | - |
7 | | -### Commands Executed during the course |
8 | | - |
9 | | -``` |
10 | | -System.out.println("Ranga") |
11 | | -List<Integer> numbers = List.of(12, 9, 13, 4, 6, 2, 4, 12, 15); |
12 | | -numbers.stream().reduce(0, (x,y)->x+y) |
13 | | -numbers.stream().reduce(0, (x,y)->x) |
14 | | -numbers.stream().reduce(0, (x,y)->y) |
15 | | -numbers.stream().reduce(0, (x,y)-> x>y ? x:y) |
16 | | -numbers.stream().reduce(Integer.MIN_VALUE, (x,y)-> x>y ? x:y) |
17 | | -numbers.stream().reduce(Integer.MIN_VALUE, (x,y)-> x>y ? y:x) |
18 | | -numbers.stream().reduce(Integer.MAX_VALUE, (x,y)-> x>y ? y:x) |
19 | | -numbers |
20 | | -numbers |
21 | | -numbers.stream().reduce(0, (x,y) -> x*x + y*y) |
22 | | -numbers.stream().map(x -> x*x).reduce(0, Integer::sum) |
23 | | -numbers.stream().map(x -> x*x*x).reduce(0, Integer::sum) |
24 | | -numbers.stream().filter(x -> x%2==1).reduce(0, Integer::sum) |
25 | | -numbers.stream().filter(x -> x%2==0).reduce(0, Integer::sum) |
26 | | -numbers.stream().distinct().forEach(System.out::println) |
27 | | -numbers |
28 | | -numbers.stream().sorted().forEach(System.out::println) |
29 | | -numbers.stream().distinct().sorted().forEach(System.out::println) |
30 | | -List<String> courses = List.of("Spring", "Spring Boot", "API" , "Microservices","AWS", "PCF","Azure", "Docker", "Kubernetes"); |
31 | | -courses |
32 | | -courses.stream().sorted().forEach(System.out::println) |
33 | | -courses |
34 | | -courses.stream().sorted().forEach(System.out::println) |
35 | | -courses.stream().sorted(Comparator.naturalOrder()).forEach(System.out::println) |
36 | | -courses.stream().sorted(Comparator.reverseOrder()).forEach(System.out::println) |
37 | | -courses.stream().sorted(Comparator.comparing(str -> str.length())).forEach(System.out::println) |
38 | | -numbers |
39 | | -courses |
40 | | -courses.stream().map(x -> x.length()).collect(Collectors.toList()) |
41 | | -numbers.stream().map(x -> x*x).collect(Collectors.toList()) |
42 | | -Supplier<String> supplier = () -> {return "Ranga";}; |
43 | | -Consumer<String> consumer = (str) -> { System.out.println(str);System.out.println(str);}; |
44 | | - |
45 | | - |
46 | | -numbers.stream() |
47 | | -List<Integer> numbers = List.of(12, 9, 13, 4, 6, 2, 4, 12, 15); |
48 | | -numbers.stream() |
49 | | -Stream.of(12, 9, 13, 4, 6, 2, 4, 12, 15).count() |
50 | | -Stream.of(12, 9, 13, 4, 6, 2, 4, 12, 15).reduce(0, Integer::sum) |
51 | | -Stream.of(12, 9, 13, 4, 6, 2, 4, 12, 15) |
52 | | -int[] numberArray = {12, 9, 13, 4, 6, 2, 4, 12, 15}; |
53 | | -Arrays.stream(numberArray) |
54 | | -Arrays.stream(numberArray).sum() |
55 | | -Arrays.stream(numberArray).average() |
56 | | -Arrays.stream(numberArray).min() |
57 | | -Arrays.stream(numberArray).max() |
58 | | -IntStream.range(1,10) |
59 | | -IntStream.range(1,10).sum() |
60 | | -IntStream.rangeClosed(1,10).sum() |
61 | | -IntStream.iterate(1, e -> e + 2).limit(10).sum() |
62 | | -IntStream.iterate(1, e -> e + 2).limit(10).peek(System.out::println).sum() |
63 | | -IntStream.iterate(2, e -> e + 2).limit(10).peek(System.out::println).sum() |
64 | | -IntStream.iterate(2, e -> e * 2).limit(10).peek(System.out::println).sum() |
65 | | -IntStream.iterate(2, e -> e * 2).limit(10).boxed().collect(Collectors.toList()) |
66 | | -Integer.MAX_VALUE |
67 | | -Long.MAX_VALUE |
68 | | -IntStream.rangeClosed(1,50).reduce(1, (x,y)->x*y) |
69 | | -LongStream.rangeClosed(1,50).reduce(1, (x,y)->x*y) |
70 | | -LongStream.rangeClosed(1,50).reduce(1L, (x,y)->x*y) |
71 | | -LongStream.rangeClosed(1,10).reduce(1, (x,y)->x*y) |
72 | | -LongStream.rangeClosed(1,20).reduce(1, (x,y)->x*y) |
73 | | -LongStream.rangeClosed(1,40).reduce(1, (x,y)->x*y) |
74 | | -LongStream.rangeClosed(1,50).mapToObj(BigInteger::valueOf).reduce(BigInteger.ONE, BigInteger::multiply) |
75 | | - |
76 | | -courses.stream().collect(Collectors.joining(" ")) |
77 | | -courses.stream().collect(Collectors.joining(",")) |
78 | | -"Spring".split("") |
79 | | -courses.stream().map(course -> course.split("")).collect(Collectors.toList()) |
80 | | -courses.stream().map(course -> course.split("")) |
81 | | -courses.stream().map(course -> course.split("")).flatMap(Arrays::stream).collect(Collectors.toList()) |
82 | | -courses.stream().map(course -> course.split("")).flatMap(Arrays::stream).distinct().collect(Collectors.toList()) |
83 | | -List<String> courses = List.of("Spring", "Spring Boot", "API" , "Microservices","AWS", "PCF","Azure", "Docker", "Kubernetes"); |
84 | | -List<String> courses2 = List.of("Spring", "Spring Boot", "API" , "Microservices","AWS", "PCF","Azure", "Docker", "Kubernetes"); |
85 | | -courses.stream().flatMap(course -> courses2.stream().map(course2 -> List.of(course,course2))).collect(Collectors.toList()) |
86 | | -courses.stream().flatMap(course -> courses2.stream().map(course2 -> List.of(course,course2))).filter(list -> list.get(0).equals(list.get(1))).collect(Collectors.toList()) |
87 | | -courses.stream().flatMap(course -> courses2.stream().map(course2 -> List.of(course,course2))).filter(list -> !list.get(0).equals(list.get(1))).collect(Collectors.toList()) |
88 | | -courses.stream().flatMap(course -> courses2.stream().filter(course2 -> course2.length()==course.length()).map(course2 -> List.of(course,course2))).filter(list -> !list.get(0).equals(list.get(1))).collect(Collectors.toList()) |
89 | | -courses.stream().filter(courses -> courses.length()>11).map(String::toUpperCase).findFirst() |
90 | | -courses.stream().peek(System.out::println).filter(courses -> courses.length()>11).map(String::toUpperCase).peek(System.out::println).findFirst() |
91 | | -courses.stream().peek(System.out::println).filter(courses -> courses.length()>11).map(String::toUpperCase).peek(System.out::println) |
92 | | -$4.findFirst() |
93 | | -List<String> courses = List.of("Spring", "Spring Boot", "API" , "Microservices","AWS", "PCF","Azure", "Docker", "Kubernetes"); |
94 | | -courses.replaceAll( str -> str.toUpperCase()) |
95 | | -List<String> modifyableCourses = new ArrayList(courses); |
96 | | -modifyableCourses.replaceAll(str -> str.toUpperCase()) |
97 | | -modifyableCourses |
98 | | -modifyableCourses.removeIf(course -> course.length()<6) |
99 | | -modifyableCourses |
100 | | - |
101 | | -``` |
102 | | - |
103 | | -## Next Steps |
104 | | - |
105 | | -## Todo |
106 | | -- Course Promotion Emails/Posts |
107 | | - - 2 Emails on Udemy |
108 | | - - 2 Emails to Email List |
109 | | -- Create YouTube Course Preview Video |
110 | | - - Add YouTube Course Preview Video as End Video for all videos |
111 | | - - Make it the YouTube Default Video |
112 | | -- Release atleast 20 small videos - one a day on Youtube |
113 | | -- Do atleast 3 Youtube live sessions |
114 | | -- After a Month |
115 | | - - UFB and Packt |
116 | | - |
117 | | - |
118 | | - |
119 | | -### Later |
120 | | - |
121 | | -- Creating a Custom Functional Interface and Creating a Lambda Expression matching it! |
122 | | -- Clarify on Passing Behavior as a Parameter. |
123 | | -- Collectors.toMap(key, value) |
124 | | -- What are the constraints in using parallel() on the Streams? |
125 | | - |
126 | | -- collect(ArrayList::new, ArrayList::add, ArrayList::addAll) |
127 | | -- partitioningBy |
128 | | - |
129 | | -Behavior Parameterization |
130 | | --> Tracing Performance of methods -> Pass function to track as a parameter |
131 | | --> Externalize Sort Behavior as a parameter |
132 | | - |
133 | | -Function Composition |
134 | | -- Function<String, Integer> lengthBis = unNullify.andThen(length); |
135 | | -- Function<String, Integer> lengthBis = length.compose(unNullify); |
136 | | -Consumer.andThen |
137 | | -- Predicate<String> startsWithJAndLengthIs7 = startsWithJ.and(lengthIs7); |
138 | | -- Predicate<String> lengthIs9orError = lengthIs9.or(equalsError); |
139 | | - |
140 | | -Design Patterns |
141 | | -- Decorator Pattern |
142 | | -- Template Method - Execute Around Pattern |
143 | | -- Strategy Pattern - Even/Odd/Prime |
144 | | - |
145 | | -Play based on Position: |
146 | | -- IntStream.range(0, input.size()).filter(pos -> input.get(pos).length() > pos).mapToObj(pos -> input.get(pos)).collect(Collectors.toList()); |
147 | | - |
148 | | -Lambda Expressions in Unit Tests => assertThrows |
149 | | - |
150 | | -Currying f(x,y) = (g(x))(y) |
151 | | -- int function(BiFunction<Integer,Integer,Integer> func, Integer value1, Integer value2) { return func.apply(value1,value2); } |
152 | | -- function((x,y) -> x + y, 2, 3) |
153 | | -- BiFunction<Integer, Integer, Integer> curry(BiFunction<Integer,Integer,Integer> func) { return (x,y) -> func.apply(x,y); } |
154 | | -- BiFunction<Integer, Integer, Integer> add = curry( (x,y) -> x+y) |
155 | | -add.apply(1,2) |
156 | | - |
157 | | -Map Operations |
158 | | -- keys.forEach(key -> map.compute(key, (k, v) -> v == null ? k : v.toUpperCase())); |
159 | | -- map.computeIfAbsent,Present,merge,putIfAbsent, computeIfPresent |
0 commit comments