Skip to content

1#16

Open
alexpol11 wants to merge 6 commits intoiaulitin:masterfrom
alexpol11:master
Open

1#16
alexpol11 wants to merge 6 commits intoiaulitin:masterfrom
alexpol11:master

Conversation

@alexpol11
Copy link

No description provided.

BigDecimal id;
String first_name;
String last_name;
String phone_number;
Copy link
Owner

Choose a reason for hiding this comment

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

А откуда snake_case пошел?

"first_name: " + this.first_name + '\n' +
"last_name: " + this.last_name + '\n' +
"phone_number: " + this.phone_number + '\n');
}
Copy link
Owner

Choose a reason for hiding this comment

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

Обычно переопределяют toString, Потом его используют при печати.

}
}

public void printUserWithMaxIdJava() {
Copy link
Owner

Choose a reason for hiding this comment

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

Java?

}
}

private User initUserFromResultSet(ResultSet user) throws SQLException {
Copy link
Owner

Choose a reason for hiding this comment

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

Лучше назвать эту переменную userResultSet или что-то такое. Без чтения сигнатуры не сразу понимается


import com.sun.org.apache.bcel.internal.generic.ARETURN;

import javax.jws.soap.SOAPBinding;
Copy link
Owner

Choose a reason for hiding this comment

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

Это два странных импорта, вряд ли они тебе нужны.
К слову, они и не используются.
ctrl + alt + O = оптимизация импортов, их схлопывание, удаление неиспользуемых

return dbEntries;
}

public boolean equalityTest() throws SQLException {
Copy link
Owner

Choose a reason for hiding this comment

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

Рекомендуется именовать методы так, чтобы первым словом в имени был глагол


public boolean equalityTest() throws SQLException {
ResultSet count1 = db1Connection.prepareStatement("select count(*) from " + table1Name).executeQuery();
ResultSet count2 = db2Connection.prepareStatement("select count(*) from " + table2Name).executeQuery();
Copy link
Owner

Choose a reason for hiding this comment

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

Снова плохое имя для resultSet.
Имя должно быть таким, чтобы при одном взгляде на него было понятно, за что оно отвечает. Про count1 кажется, что он должен быть интом с количеством чего-то. Я бы лучше назвал countResultSet1

count1.next();
count2.next();
int size1 = Integer.parseInt(count1.getString(1));
int size2 = Integer.parseInt(count2.getString(1));
Copy link
Owner

Choose a reason for hiding this comment

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

Почему не getLong какой-нибудь?

IntStream.range(1, columnsNum).reduce(0, (acc, j) -> acc == 0 ? t1.get(j).compareTo(t2.get(j - 1)) : acc)
);
db2Entries.sort((t1, t2) ->
IntStream.range(1, columnsNum).reduce(0, (acc, j) -> acc == 0 ? t1.get(j).compareTo(t2.get(j - 1)) : acc)
Copy link
Owner

Choose a reason for hiding this comment

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

Чет сложно, объяснишь?

IntStream.range(0, columnsNum).reduce(0,
(innerAcc, j) -> innerAcc == 0 ?
db1Entries.get(i).get(j).compareTo(db2Entries.get(i).get(j)) : innerAcc
) : acc
Copy link
Owner

Choose a reason for hiding this comment

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

Операции над стримами принято писать с новой строки.
myList.stream()
.map(..)
.filter(...)
.collect();

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

Comments