/** Ensures that the children are sorted in z-order sequence. */ private void ensureSorted() { if (needsSorting) { Collections.sort(children, FigureLayerComparator.INSTANCE); needsSorting = false; } }