@SuppressWarnings("unchecked")
    public <T extends Shape> Set<T> toSet(Class<T> shapeType) {
        return (Set<T>) cachedTypes.computeIfAbsent(shapeType, t -> {
            Set<T> result = new HashSet<>();
            for (Shape shape : shapeMap.values()) {
                if (shapeType.isInstance(shape)) {
                    result.add((T) shape);
                }
            }
            return Collections.unmodifiableSet(result);
        });
    }
Gets an immutable Set of shapes of a specific type.

@param shapeType Type of shape to get a set of.
@param <T> Shape type to get from the index.
@return Returns an unmodifiable set of shapes.
smithy-model/src/main/java/software/amazon/smithy/model/Model.java