Conversation
lidaamber
left a comment
There was a problem hiding this comment.
Thanks for your work, but what is the purpose of your PR? Have a look at existing PRs in this repo. The same one already exists and it requires changes very similar to your ones.
Secondly, you should format your code and add code style changes.
src/src/DoWhile.java
Outdated
| do { | ||
| System.out.println(i++); | ||
|
|
||
| }while (i < 10); |
src/src/For.java
Outdated
| public class For { | ||
| public static void main(String[] args) { | ||
| for (int i = 0; i < 10; i++) | ||
| { |
src/src/ForEach.java
Outdated
| public class ForEach { | ||
| public static void main(String[] args) { | ||
| List<Integer> 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()))); |
There was a problem hiding this comment.
Could you split this line to fit 100 symbols in line, please?
| public class ForOf { | ||
| public static void main(String[] args) { | ||
| for (int elem: new int[]{7, 10, 1, 5, 2}) | ||
| { |
src/src/Map.java
Outdated
| public class Map { | ||
| public static void main(String[] args) { | ||
|
|
||
| Function<Integer,Void> log = s -> {System.out.println(s); return null;}; |
There was a problem hiding this comment.
Using a forEach(), you don't need this function at all.
| public static void main(String[] args) { | ||
| int i = 0; | ||
| while (i<10) | ||
| { |
src/src/Map.java
Outdated
| public static void main(String[] args) { | ||
|
|
||
| Function<Integer,Void> log = s -> {System.out.println(s); return null;}; | ||
| Arrays.stream(new Integer[]{7, 10, 1, 5, 2}).map(x -> x * 2).map(log); |
There was a problem hiding this comment.
I'd rather use forEach() instead of map() for this example.
lidaamber
left a comment
There was a problem hiding this comment.
Thanks, could you format your code, please?
src/src/Map.java
Outdated
| public class Map { | ||
| public static void main(String[] args) { | ||
|
|
||
| Function<Integer,Void> log = s -> {System.out.println(s); return null;}; |
There was a problem hiding this comment.
Using a forEach(), you don't need this function at all.
| public static void main(String[] args) { | ||
| List<Integer> 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()))); | ||
| list.forEach(item -> System.out.println(String.format("%s, %s, %s",item,list.indexOf(item), |
There was a problem hiding this comment.
I don't undestrand, how to formatting this code?
There was a problem hiding this comment.
You can have a look at Google Java Style Guide. Your IDE definitely provides tools to format code according to the selected code style. For example, if you use IntellijIdea, you can format your code using Alt + Cmd + L.
src/src/DoWhile.java
Outdated
| do { | ||
| System.out.println(i++); | ||
|
|
||
| }while (i < 10); |
| do { | ||
| System.out.println(i++); | ||
| }while (i < 10); | ||
| do {System.out.println(i++);}while (i < 10); |
No description provided.