= cold cleanup

* using lambda if possible (we are already building in Java8)
  * using diamond when new generic instance
  * remove used improt
This commit is contained in:
zavakid
2020-09-17 10:48:15 +08:00
parent df60eda679
commit e7658879bc
133 changed files with 990 additions and 1558 deletions

View File

@@ -37,7 +37,7 @@ public class JsonDiffConversion {
public static StringBuilder print_json_diff(LogBuffer buffer, long len, String columnName, int columnIndex,
String charsetName) {
int position = buffer.position();
List<String> operation_names = new ArrayList<String>();
List<String> operation_names = new ArrayList<>();
while (buffer.hasRemaining()) {
int operation_int = buffer.getUint8();
if (operation_int >= JSON_DIFF_OPERATION_COUNT) {

View File

@@ -16,7 +16,7 @@ import com.taobao.tddl.dbsync.binlog.event.TableMapLogEvent;
*/
public final class LogContext {
private final Map<Long, TableMapLogEvent> mapOfTable = new HashMap<Long, TableMapLogEvent>();
private final Map<Long, TableMapLogEvent> mapOfTable = new HashMap<>();
private FormatDescriptionLogEvent formatDescription;

View File

@@ -601,7 +601,7 @@ public final class TableMapLogEvent extends LogEvent {
private void parse_signedness(LogBuffer buffer, int length) {
// stores the signedness flags extracted from field
List<Boolean> datas = new ArrayList<Boolean>();
List<Boolean> datas = new ArrayList<>();
for (int i = 0; i < length; i++) {
int ut = buffer.getUint8();
for (int c = 0x80; c != 0; c >>= 1) {
@@ -622,7 +622,7 @@ public final class TableMapLogEvent extends LogEvent {
// stores collation numbers extracted from field.
int limit = buffer.position() + length;
this.default_charset = (int) buffer.getPackedLong();
List<TableMapLogEvent.Pair> datas = new ArrayList<TableMapLogEvent.Pair>();
List<TableMapLogEvent.Pair> datas = new ArrayList<>();
while (buffer.hasRemaining() && buffer.position() < limit) {
int col_index = (int) buffer.getPackedLong();
int col_charset = (int) buffer.getPackedLong();
@@ -639,7 +639,7 @@ public final class TableMapLogEvent extends LogEvent {
private List<Integer> parse_column_charset(LogBuffer buffer, int length) {
// stores collation numbers extracted from field.
int limit = buffer.position() + length;
List<Integer> datas = new ArrayList<Integer>();
List<Integer> datas = new ArrayList<>();
while (buffer.hasRemaining() && buffer.position() < limit) {
int col_charset = (int) buffer.getPackedLong();
datas.add(col_charset);
@@ -664,10 +664,10 @@ public final class TableMapLogEvent extends LogEvent {
// into a string separate vector. All of them are stored
// in 'vec'.
int limit = buffer.position() + length;
List<List<String>> datas = new ArrayList<List<String>>();
List<List<String>> datas = new ArrayList<>();
while (buffer.hasRemaining() && buffer.position() < limit) {
int count = (int) buffer.getPackedLong();
List<String> data = new ArrayList<String>(count);
List<String> data = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
int len1 = (int) buffer.getPackedLong();
data.add(buffer.getFixString(len1));
@@ -694,7 +694,7 @@ public final class TableMapLogEvent extends LogEvent {
// stores geometry column's types extracted from field.
int limit = buffer.position() + length;
List<Integer> datas = new ArrayList<Integer>();
List<Integer> datas = new ArrayList<>();
while (buffer.hasRemaining() && buffer.position() < limit) {
int col_type = (int) buffer.getPackedLong();
datas.add(col_type);

View File

@@ -30,7 +30,7 @@ public class LogHeaderTest {
final LogHeader objectUnderTest = new LogHeader(type);
// Assert side effects
final HashMap<String, String> hashMap = new HashMap<String, String>();
final HashMap<String, String> hashMap = new HashMap<>();
Assert.assertEquals(hashMap, objectUnderTest.gtidMap);
}