Skip to content

Java 01. ДЗ 05. Малютина Катя, подгруппа 2#58

Open
ekaterinaMaljutina wants to merge 7 commits intojava-course-au:masterfrom
ekaterinaMaljutina:task-functional-java
Open

Java 01. ДЗ 05. Малютина Катя, подгруппа 2#58
ekaterinaMaljutina wants to merge 7 commits intojava-course-au:masterfrom
ekaterinaMaljutina:task-functional-java

Conversation

@ekaterinaMaljutina
Copy link
Copy Markdown

public final class Collections {

public static <T, R>
Iterable<R> map(Function1<? super T, R> f, Iterable<T> a) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

см что написано про возвращаемые типы в задании


public abstract Boolean apply(T t);

static final Predicate ALWAYS_TRUE = new Predicate() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

generic параметры?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

-0.5

}
};

static final Predicate ALWAYS_FALSE = new Predicate() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

и здесь

@@ -0,0 +1,272 @@
package ru.spbau.mit;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

wildcard'ы не проверяются

ленивость предикатов не проверяется

тесты конечно желательно по соответствующим классам разносить

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

-0.5

@ekaterinaMaljutina
Copy link
Copy Markdown
Author

@sproshev тут, я наверно забыла написать, что поправила замечания)

public Boolean apply(Object o) {
return false;
}
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

надо заиспользовать ALWAYS_T и F в тестах, тогда станет понятно, есть ли какие-то проблемы в них)

ArrayList<String> str = new ArrayList<>();
str.add("bbbb");
str.add("aaa");
str.add("ccc");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

List<String> str = Arrays.asList("bbbb", "aaa", "ccc");

public Boolean apply(Object object) {
return null;
}
}, new ArrayList<Integer>());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Collections.emptyList()

for (int i = value, n = 0; n < 20; i++, n++) {
Assert.assertTrue(i + 1 == f.apply(i));
Assert.assertTrue(i - 1 == g.apply(i));
Assert.assertTrue(i == f.compose(g).apply(i));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

assertEquals

@ekaterinaMaljutina
Copy link
Copy Markdown
Author

@sproshev Поправила.

@sproshev
Copy link
Copy Markdown

Predicate.ALWAYS_TRUE.apply(new Object()); не компилируется

@ekaterinaMaljutina
Copy link
Copy Markdown
Author

@sproshev Поправила.

@sproshev
Copy link
Copy Markdown

9

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.

2 participants