void (@NotNull String oldMessage, @NotNull String newMessage) { if (oldMessage.equals(LAST_COMMIT_MESSAGE)) { LAST_COMMIT_MESSAGE = newMessage; } updateRecentMessages(recentMessages -> { int index = recentMessages.indexOf(oldMessage); if (index >= 0) { recentMessages.remove(index); recentMessages.add(index, newMessage); } else { LOG.debug("Couldn't find message [" + oldMessage + "] in the messages history"); addCommitMessage(recentMessages, newMessage); } }); }