I have array inside array, I a need find in second array some items and remove parent array, but when I'm trying remove array I had an error java.lang.IllegalStateException
 productsList = new ArrayList<>(mSortModels);
    for (ProductComponentsResponse component : filterData) {
        String componentId = component.getId();
        int componentState = component.getState();
        Iterator<ProductResponse> iterator = productsList.iterator();
        while (iterator.hasNext()) {
            ProductResponse next = iterator.next();
            for (ProductComponentsResponse productComponentsResponse: next.getProductComponents()) {
                boolean containComponent = productComponentsResponse.getId().contains(componentId);
                if (componentState == ProductComponentsResponse.FilterState.NONE) {
                    continue;
                } else if (componentState == ProductComponentsResponse.FilterState.SELECTED) {
                    if (!containComponent) {
                        Log.d("component", String.valueOf(containComponent));
                        ***iterator.remove();*** - this error line
                    }
                } else if (componentState == ProductComponentsResponse.FilterState.UNSELECTED) {
                    if (containComponent) {
                        iterator.remove();
                    }
                }
            }
        }
    }
    notifyDataSetChanged();
 
     
    