public int[] add(final int zLevel, final boolean redraw, @Nullable final Layer ... layers) {
        if (layers == null) {
            return new int[0];
        }
        final int[] context = new int[layers.length + 1];

        layerLock.lock();
        try {
            Map<Integer, Layer> zLevelMap = this.layerItemMap.get(zLevel);
            if (zLevelMap == null) {
                zLevelMap = new HashMap<>();
                this.layerItemMap.put(zLevel, zLevelMap);
            }
            context[0] = zLevel;
            int pos = 1;
            for (Layer layer : layers) {
                if (layer == null) {
                    continue;
                }
                final int itemId = idProvider.addAndGet(1);
                zLevelMap.put(itemId, layer);
                context[pos++] = itemId;
            }
        } finally {
            layerLock.unlock();
        }
        if (redraw) {
            requestRedraw();
        }
        return context;
    }
adds layers to this group with a given zLevel
main/src/main/java/cgeo/geocaching/unifiedmap/geoitemlayer/MapsforgeV6ZLevelGroupLayer.java