class OptimizedCountTerminator<ENTITY> implements CountTerminator<ENTITY> {

    private OptimizedCountTerminator() {
    }

    @Override
    public <T> long apply(
        final SqlStreamOptimizerInfo<ENTITY> info,
        final SqlStreamTerminator<ENTITY> sqlStreamTerminator,
        final ReferencePipeline<T> pipeline
    ) {<FILL_FUNCTION_BODY>}

    public static final CountTerminator<?> INSTANCE = new OptimizedCountTerminator<>();

    @SuppressWarnings("unchecked")
    public static <ENTITY> CountTerminator<ENTITY> create() {
        return (CountTerminator<ENTITY>) INSTANCE;
    }

}

        requireNonNull(info);
        requireNonNull(sqlStreamTerminator);
        requireNonNull(pipeline);
        return countHelper(
            info,
            sqlStreamTerminator,
            pipeline,
            () -> CountTerminator.<ENTITY>defaultTerminator().apply(info, sqlStreamTerminator, pipeline)
        );
    
<no_super_class>