#745: RecentQueue.java

projectforge-business/src/main/java/org/projectforge/framework/utils/RecentQueue.java Lines: 137 · Author: Kai Reinhard · Type: Java generic bounded FIFO 137 lines · 82 code · 39 comments · 16 blank

Purpose

Bounded "recently used" queue — the data structure behind every "Recent items" dropdown in ProjectForge. 137 lines. Stores up to maxSize (default 25) entries, with the newest at position 0. When an entry is re-added, it moves to the front rather than duplicating. Oldest entries are evicted. Thread-safe via synchronized(this) on mutations. Serialized to XML via XStream for persistence in user preferences.

Key methods

XStream compatibility

Annotated @XStreamAlias("recents") on the recentList field (note the typo "recents" not "recents" — it's intentional). The comment says: "Was named recents in former version (before 2020-04-05)" — this is a backward-compatibility alias. Old preferences XML used <recents> as the element name; when the field was renamed to recentList, the alias preserved the old XML format so existing user preferences didn't break.