docs: @SuppressWarnings("unchecked")
    public void restoreState(Map<String, Serializable> state) {
      LOG.info("Restoring window manager state");
  
      //restore eviction policy state
      if (state.get(EVICTION_STATE_KEY) != null) {
        ((EvictionPolicy) evictionPolicy).restoreState(state.get(EVICTION_STATE_KEY));
      }
  
      // restore trigger policy state
      if (state.get(TRIGGER_STATE_KEY) != null) {
        ((TriggerPolicy) triggerPolicy).restoreState(state.get(TRIGGER_STATE_KEY));
      }
  
      // restore all pending events to the queue
      this.queue.addAll((Collection<Event<T>>) state.get(QUEUE));
  
      // restore all expired events
      this.expiredEvents.addAll((List<T>) state.get(EXPIRED_EVENTS));
  
      // restore all prevWindowEvents
      this.prevWindowEvents.addAll((Set<Event<T>>) state.get(PRE_WINDOW_EVENTS));
  
      // restore the count of the number events since last expiry
      this.eventsSinceLastExpiry.set((int) state.get(EVENTS_SINCE_LAST_EXPIRY));
    }