-
Notifications
You must be signed in to change notification settings - Fork 0
Java05. ДЗ 05, Егоров Антон #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| return null; | ||
| } | ||
| }) | ||
| .filter(s -> s.matches(".*"+sequence.toString()+".*")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
см метод contains
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вызов toString на sequence надо убрать (его и до этого не должно было быть)
| return Files.lines(Paths.get(p)); | ||
| } catch (IOException e) { | ||
| // TODO Auto-generated catch block | ||
| e.printStackTrace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
плохой способ обработки ошибок) либо пробрасываем наружу, см UncheckedIOException, либо как-то игнорируем
| c[0] += 1; | ||
| return c; | ||
| }); | ||
| return experimentCount[1] / experimentCount[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
верно ли, что после свертки c[0] == experimentCount[0] == 10000?
| .stream() | ||
| .max(Comparator.comparingLong(entr -> entr.getValue() | ||
| .stream() | ||
| .flatMapToInt(String::chars) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
зачем подсчитывать символы, если известна длина строки? String.length
| .max(Comparator.comparingLong(entr -> entr.getValue() | ||
| .stream() | ||
| .flatMapToInt(String::chars) | ||
| .count())).orElse(new Entry<String, List<String>>() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше сперва сделать map, а потом orElse(null)
| assertEquals("Auth2", | ||
| SecondPartTasks.findPrinter(testMap)); | ||
|
|
||
| testMap = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collections.emptyMap
| "bc", | ||
| "cdk")); | ||
|
|
||
| testMap.put("Auth3", Arrays.asList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collections.emptyList
| @Test | ||
| public void testFindQuotes() { | ||
| assertEquals( | ||
| Arrays.asList("askdlcewline kabra"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collections.singletonList
| .stream() | ||
| .max(Comparator.comparingInt(entr -> entr.getValue() | ||
| .stream() | ||
| .collect(Collectors.summingInt(String::length)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.mapToInt(String::length).sum()
No description provided.