RecentQueue.javaBounded "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.
append(T entry) — the main mutator. If the entry already exists (found by indexOf() → uses equals()), removes it first (deduplication). If at capacity, removes the oldest entry (at the end of the list). Inserts at position 0. Returns this for chaininggetRecent() — returns get(0) (most recent) or null if emptyget(Integer pos) — null-safe — returns null for invalid positions instead of throwing IndexOutOfBoundsException. Also handles pos == null by returning get(0). This defensive design is for Wicket serialization edge casesaddOnly(T entry) — adds without eviction (ignores maxSize). Used when initializing from saved XML — the queue was already truncated at save time, so re-adding should not evictAnnotated @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.