-
Notifications
You must be signed in to change notification settings - Fork 14
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
base: master
Are you sure you want to change the base?
Java 01. ДЗ 05. Малютина Катя, подгруппа 2 #58
Conversation
public final class Collections { | ||
|
||
public static <T, R> | ||
Iterable<R> map(Function1<? super T, R> f, Iterable<T> a) { |
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.
см что написано про возвращаемые типы в задании
|
||
public abstract Boolean apply(T t); | ||
|
||
static final Predicate ALWAYS_TRUE = new Predicate() { |
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.
generic параметры?
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.
-0.5
} | ||
}; | ||
|
||
static final Predicate ALWAYS_FALSE = new Predicate() { |
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.
и здесь
@@ -0,0 +1,272 @@ | |||
package ru.spbau.mit; |
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.
wildcard'ы не проверяются
ленивость предикатов не проверяется
тесты конечно желательно по соответствующим классам разносить
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.
-0.5
@sproshev тут, я наверно забыла написать, что поправила замечания) |
public Boolean apply(Object o) { | ||
return false; | ||
} | ||
}; |
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.
надо заиспользовать ALWAYS_T и F в тестах, тогда станет понятно, есть ли какие-то проблемы в них)
ArrayList<String> str = new ArrayList<>(); | ||
str.add("bbbb"); | ||
str.add("aaa"); | ||
str.add("ccc"); |
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.
List<String> str = Arrays.asList("bbbb", "aaa", "ccc");
public Boolean apply(Object object) { | ||
return null; | ||
} | ||
}, new ArrayList<Integer>()); |
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()
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)); |
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.
assertEquals
@sproshev Поправила. |
|
@sproshev Поправила. |
9 |
@sproshev