List<Set<UiNode>> splitByLayer(List<String> layerTags,
                                   Set<? extends UiNode> nodes) {
        final int nLayers = layerTags.size();
        if (!layerTags.get(nLayers - 1).equals(LAYER_DEFAULT)) {
            throw new IllegalArgumentException(E_DEF_NOT_LAST);
        }

        List<Set<UiNode>> splitList = new ArrayList<>(layerTags.size());
        Map<String, Set<UiNode>> byLayer = new HashMap<>(layerTags.size());

        for (String tag : layerTags) {
            Set<UiNode> set = new HashSet<>();
            byLayer.put(tag, set);
            splitList.add(set);
        }

        for (UiNode n : nodes) {
            String which = n.layer();
            if (!layerTags.contains(which)) {
                which = LAYER_DEFAULT;
            }
            byLayer.get(which).add(n);
        }

        return splitList;
    }
@Test
    public void oneLayer() {
        title("oneLayer()");

        List<Set<UiNode>> result = t2.splitByLayer(DEF_TAG_ONLY, NODES);
        print(result);

        assertEquals("wrong split size", 1, result.size());
        Set<UiNode> def = result.get(0);

        assertEquals("def bad size", 6, def.size());
        assertEquals("missing node D", true, def.contains(NODE_D));
        assertEquals("missing node F", true, def.contains(NODE_F));
        assertEquals("missing node A", true, def.contains(NODE_A));
        assertEquals("missing node C", true, def.contains(NODE_C));
        assertEquals("missing node B", true, def.contains(NODE_B));
        assertEquals("missing node E", true, def.contains(NODE_E));
    }