Skip to content

Lab07 (TreeSet)#12

Merged
jzuken merged 6 commits intomasterfrom
Lab07
Dec 9, 2017
Merged

Lab07 (TreeSet)#12
jzuken merged 6 commits intomasterfrom
Lab07

Conversation

@alefedor
Copy link
Copy Markdown
Owner

Я так понял, что для методов вроде add, floor javadoc уже есть (из interface), поэтому ничего писать не нужно

* Implementation of set using binary tree and a list over it
* @param <E> type of key to store
*/
public class MyTreeSet<E extends Comparable<E>> extends AbstractSet<E> implements IMyTreeSet<E>{
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

тут бы каких-нибудь полезных wildcard'ов добавить было бы неплохо

return v;
else
return placeToInsert(v.left, key);
}else{
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

тут как-то пробелов не хватает

size--;
if (node.left == null){
hang(node.parent, node, node.right);
}else{
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

и тут пробелы

first = st.first;
last = st.last;
size = st.size();
reverseOrder = !st.reverseOrder;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

нуу, я бы для снижения wtf-ности кода передал бы этот параметр в конструкторе. а то этот конструктор имеет неочевидный побочный эффект

assertTrue(set.add(i));
}
int i = 0;
for (Iterator<Integer> iterator = set.iterator(); iterator.hasNext(); ) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

вполне можно заменить на обычный foreach-цикл: for (Integer value : set)

@jzuken jzuken merged commit c9d80f8 into master Dec 9, 2017
@jzuken jzuken deleted the Lab07 branch December 9, 2017 10:23
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