I add a ol.layer.Vector OR ol.layer.Group with a mouse click in the map. By a new mouse click should the layer removed/deleted AND a new layer should be add. etc.
I have search and search and don't found a simple methode. There is all complicated or don't work, or with Ajax or JQuery (i don't use it).
Then i use this and that is the best solution:
if (map.getLayers().array_.length > 1) {
map.getLayers().array_.pop();
}
That works absolutelly perfect and is absolutelly simple. OpenLayers does not seem to have such a simple solution.