void (@NotNull IntSet idsToRemove, @NotNull List<? extends CharSequence> namesToRemove) { boolean isCaseSensitive = isCaseSensitive(); synchronized (myData) { // remove from the array by merging two sorted lists int[] newIds = new int[myData.myChildrenIds.length]; int[] oldIds = myData.myChildrenIds; int o = 0; for (int oldId : oldIds) { if (!idsToRemove.contains(oldId)) { assert oldId > 0 : Arrays.toString(oldIds); newIds[o++] = oldId; } } if (o != newIds.length) { newIds = o == 0 ? ArrayUtil.EMPTY_INT_ARRAY : Arrays.copyOf(newIds, o); } myData.myChildrenIds = newIds; if (!allChildrenLoaded()) { myData.addAdoptedNames(namesToRemove, isCaseSensitive); } assertConsistency(isCaseSensitive, namesToRemove); } }