package ca.antonious.viewcelladapter;

import java.util.List;

/**
 * Created by George on 2016-12-17.
 */

public class CompositeSection extends AbstractSection {
    private List<AbstractSection> sections;

    @Override
    public AbstractViewCell get(int position) {
        return ViewCellUtils.getViewCell(sections, position);
    }

    @Override
    public void remove(int position) {
        int sectionIndex = ViewCellUtils.getSectionIndex(sections, position);
        int viewCellIndex = ViewCellUtils.getViewCellIndex(sections, position);

        sections.get(sectionIndex).remove(viewCellIndex);
    }

    @Override
    public int getItemCount() {
        return ViewCellUtils.getTotalCount(sections);
    }

    private CompositeSection addSection(AbstractSection section) {
        sections.add(section);
        return this;
    }

    private CompositeSection removeSection(AbstractSection section) {
        sections.remove(section);
        return this;
    }
}

Add CompositeSection if you want to wrap multiple sections