@Override
  @NotNull
  public <F extends Facet<?>> Collection<F> getFacetsByType(@NotNull Facet<?> underlyingFacet, FacetTypeId<F> typeId) {
    if (myChildFacets == null) {
      MultiMap<FacetAndType, Facet<?>> children = new MultiMap<>();
      for (Facet<?> facet : getAllFacets()) {
        Facet<?> underlying = facet.getUnderlyingFacet();
        if (underlying != null) {
          children.putValue(new FacetAndType(underlying,  facet.getTypeId()), facet);
        }
      }
      myChildFacets = children.freezeValues();
    }
    //noinspection unchecked
    Collection<F> facets = (Collection<F>)myChildFacets.get(new FacetAndType(underlyingFacet, typeId));
    return facets != null ? facets : Collections.emptyList();
  }
@Override
  @NotNull
  public <F extends Facet<?>> Collection<F> getFacetsByType(@NotNull Facet<?> underlyingFacet, FacetTypeId<F> typeId)