回答編集履歴
1
コード短縮
test
CHANGED
@@ -438,7 +438,13 @@
|
|
438
438
|
|
439
439
|
private int nextPid = 0;
|
440
440
|
|
441
|
-
private Map<Integer,String> rows;
|
441
|
+
private Map<Integer,String> rows = new TreeMap<Integer, String>();
|
442
|
+
|
443
|
+
DummyDatabaseAccessor() {
|
444
|
+
|
445
|
+
for(String s : TEST) rows.put(nextPid++, s);
|
446
|
+
|
447
|
+
}
|
442
448
|
|
443
449
|
@Override
|
444
450
|
|
@@ -446,18 +452,6 @@
|
|
446
452
|
|
447
453
|
MyTableModel tableModel = new MyTableModel(this);
|
448
454
|
|
449
|
-
if(rows == null) {
|
450
|
-
|
451
|
-
rows = new TreeMap<Integer, String>();
|
452
|
-
|
453
|
-
for(String s : TEST) {
|
454
|
-
|
455
|
-
rows.put(nextPid++, s);
|
456
|
-
|
457
|
-
}
|
458
|
-
|
459
|
-
}
|
460
|
-
|
461
455
|
for(Map.Entry<Integer,String> entry : rows.entrySet()) {
|
462
456
|
|
463
457
|
tableModel.addRow(entry.getKey(), entry.getValue());
|
@@ -468,8 +462,6 @@
|
|
468
462
|
|
469
463
|
}
|
470
464
|
|
471
|
-
|
472
|
-
|
473
465
|
@Override
|
474
466
|
|
475
467
|
public int insert(String text) {
|
@@ -482,8 +474,6 @@
|
|
482
474
|
|
483
475
|
}
|
484
476
|
|
485
|
-
|
486
|
-
|
487
477
|
@Override
|
488
478
|
|
489
479
|
public int update(int pid, String text) {
|
@@ -498,8 +488,6 @@
|
|
498
488
|
|
499
489
|
}
|
500
490
|
|
501
|
-
|
502
|
-
|
503
491
|
@Override
|
504
492
|
|
505
493
|
public int delete(int pid) {
|