ConsoleHistory: small optimization

This commit is contained in:
Anton Makeev
2016-01-07 12:15:18 +01:00
parent bacb13f0a1
commit 5b277139f3
2 changed files with 8 additions and 2 deletions
@@ -136,7 +136,7 @@ public class ConsoleHistoryController {
}
public boolean hasHistory() {
return !getModel().getEntries().isEmpty();
return !getModel().isEmpty();
}
@NotNull
@@ -555,7 +555,7 @@ public class ConsoleHistoryController {
private void saveHistory() {
try {
if (getModel().getEntries().isEmpty()) return;
if (getModel().isEmpty()) return;
if (myRootType.isHidden()) {
saveHistoryOld();
return;
@@ -96,6 +96,12 @@ class ConsoleHistoryModel extends SimpleModificationTracker {
}
}
public boolean isEmpty() {
synchronized (myLock) {
return myEntries.isEmpty();
}
}
public int getHistorySize() {
synchronized (myLock) {
return myEntries.size();