TreeModelEvent (@NotNull TreePath path, Map<Object, Integer> map) { if (map == null || map.isEmpty()) return new TreeModelEvent(this, path, null, null); int i = 0; int size = map.size(); int[] indices = new int[size]; Object[] children = new Object[size]; for (Entry<Object, Integer> entry : map.entrySet()) { indices[i] = entry.getValue(); children[i] = entry.getKey(); i++; } return new TreeModelEvent(this, path, indices, children); }