Skip to content

Java02. ДЗ 01, Лобанов Артём#4

Open
ArtyomLobanov wants to merge 4 commits into
masterfrom
task02
Open

Java02. ДЗ 01, Лобанов Артём#4
ArtyomLobanov wants to merge 4 commits into
masterfrom
task02

Conversation

@ArtyomLobanov
Copy link
Copy Markdown
Owner

Первое дз про MyHashMap

@@ -0,0 +1,136 @@
package ru.spbau.lobanov.collections;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

эти файлы лежат не там, где надо. Если открывать идеей build.gradle, то они вполне справедливо не подхватываются

Copy link
Copy Markdown
Owner Author

@ArtyomLobanov ArtyomLobanov Sep 27, 2016

Choose a reason for hiding this comment

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

Теперь как надо?

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 @@
#Mon Sep 19 21:18:32 MSK 2016
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

закоммичены лишние файлы

Entry(K key, V value) {
this.key = key;
this.value = value;
this.hash = key.hashCode();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this лишний

size++;
}

private int getIndex(int hash) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

getIndex везде используется вместе с таблицей, может как раз table[getIndex(...)] выделить в метод?

@@ -0,0 +1,92 @@
package ru.spbau.lobanov.collections;

public class MyLinkedList<E> { // implements Iterable<E>, is Iterable a part of std lib?
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

часть, но т.к. он за тебя ничего не делает, то отнаследоваться можно было

private boolean equals(E first, E second) {
if (first == null)
return second == null;
return first.equals(second);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

см. Objects.equals

map.clear();
assertEquals(0, map.size());
for (int i = 0; i < 512; i ++) {
assertSame(null, map.get("key" + 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.

assertNull

assertSame(null, map.get("key" + 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.

не вся функциональность таблицы проверятся, см. изначальные комменты

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