Skip to content

Conversation

@pvktk
Copy link
Owner

@pvktk pvktk commented May 17, 2018

No description provided.

return null;
}
})
.filter(s -> s.matches(".*"+sequence.toString()+".*"))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

см метод contains

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();

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];

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)

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>>() {

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<>();

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());

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"),

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))))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.mapToInt(String::length).sum()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants