void (@NotNull PlaceInfo next, int limit, boolean isChanged) { LinkedList<PlaceInfo> list = isChanged ? myChangePlaces : myBackPlaces; MessageBus messageBus = myProject.getMessageBus(); RecentPlacesListener listener = messageBus.syncPublisher(RecentPlacesListener.TOPIC); if (!list.isEmpty()) { PlaceInfo prev = list.getLast(); if (isSame(prev, next)) { PlaceInfo removed = list.removeLast(); listener.recentPlaceRemoved(removed, isChanged); } } list.add(next); listener.recentPlaceAdded(next, isChanged); if (list.size() > limit) { PlaceInfo first = list.removeFirst(); listener.recentPlaceRemoved(first, isChanged); } }