Skip to content
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

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

ekaterinaMaljutina
Copy link

public final class Collections {

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

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

Choose a reason for hiding this comment

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

generic параметры?

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

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;

Choose a reason for hiding this comment

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

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

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

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

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
Author

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

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

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

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

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

Choose a reason for hiding this comment

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

assertEquals

@ekaterinaMaljutina
Copy link
Author

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

@sproshev
Copy link

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

@ekaterinaMaljutina
Copy link
Author

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

@sproshev
Copy link

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