The javadoc of UIComponent.getFacets() says this:
"... Return a mutable Map representing the facet UIComponents associated with this UIComponent, keyed by facet name (which must be a String). The returned implementation must support all of the standard and optional Map methods, plus support the following additional requirements:
- The Map implementation must implement the java.io.Serializable interface.
- Any attempt to add a null key or value must throw a NullPointerException.
- Any attempt to add a key that is not a String must throw a ClassCastException.
- Any attempt to add a value that is not a UIComponent must throw a ClassCastException.
- Whenever a new facet UIComponent is added:
- The parent property of the component must be set to this component instance.
- If the parent property of the component was already non-null, the component must first be removed from its previous parent (where it may have been either a child or a facet).
- Whenever an existing facet UIComponent is removed:
- The parent property of the facet must be set to null.
The current implementation is not strict about "... the returned implementation must support all of the standard and optional Map methods ...". There are ways to modify facet map indirectly, using iterator.remove(), or entry.setValue() or removing some key, value from entrySet(), keySet() or values() collection.