class SortByCountIdHolderList extends IdHolderList {

    private static final long serialVersionUID = -7779357582250824558L;

    private final List<IdHolder> mergedHolders;

    public SortByCountIdHolderList(boolean paging) {
        super(paging);
        this.mergedHolders = new ArrayList<>();
    }

    @Override
    public boolean add(IdHolder holder) {<FILL_FUNCTION_BODY>}

    private class SortByCountIdHolder extends FixedIdHolder {

        private final Map<Id, Integer> ids;

        public SortByCountIdHolder(Query parent) {
            super(new MergedQuery(parent), ImmutableSet.of());
            this.ids = InsertionOrderUtil.newMap();
        }

        public void merge(IdHolder holder) {
            for (Id id : holder.all()) {
                this.ids.compute(id, (k, v) -> v == null ? 1 : v + 1);
                Query.checkForceCapacity(this.ids.size());
            }
        }

        @Override
        public boolean keepOrder() {
            return true;
        }

        @Override
        public Set<Id> all() {
            return CollectionUtil.sortByValue(this.ids, false).keySet();
        }

        @Override
        public String toString() {
            return String.format("%s{merged:%s}",
                                 this.getClass().getSimpleName(), this.query);
        }
    }

    private class MergedQuery extends Query {

        public MergedQuery(Query parent) {
            super(parent.resultType(), parent);
        }

        @Override
        public String toString() {
            return SortByCountIdHolderList.this.mergedHolders.toString();
        }
    }
}

        if (this.paging()) {
            return super.add(holder);
        }
        this.mergedHolders.add(holder);

        if (super.isEmpty()) {
            Query parent = holder.query().originQuery();
            super.add(new SortByCountIdHolder(parent));
        }
        SortByCountIdHolder sortHolder = (SortByCountIdHolder) this.get(0);
        sortHolder.merge(holder);
        return true;
    
<methods>public void <init>(boolean) ,public boolean add(org.apache.hugegraph.backend.page.IdHolder) ,public boolean addAll(Collection<? extends org.apache.hugegraph.backend.page.IdHolder>) ,public static org.apache.hugegraph.backend.page.IdHolderList empty(boolean) ,public boolean paging() <variables>private static final org.apache.hugegraph.backend.page.IdHolderList EMPTY_NP,private static final org.apache.hugegraph.backend.page.IdHolderList EMPTY_P,private final non-sealed boolean paging,private static final long serialVersionUID