public Set<Shape> toSet() {
        return new AbstractSet<Shape>() {
            @Override
            public int size() {
                return shapeMap.size();
            }

            @Override
            public boolean contains(Object o) {
                return o instanceof Shape && shapeMap.containsKey(((Shape) o).getId());
            }

            @Override
            public Iterator<Shape> iterator() {
                return shapeMap.values().iterator();
            }

            @Override
            public Stream<Shape> stream() {
                return shapes();
            }

            @Override
            public Stream<Shape> parallelStream() {
                return shapes().parallel();
            }
        };
    }
Converts the model to an immutable Set of shapes.

@return Returns an unmodifiable set of shapes.
smithy-model/src/main/java/software/amazon/smithy/model/Model.java