public void removeAll(){
  List<Layer> oldLayers=getLayerList();
  if (allLayers == null || allLayers.isEmpty()) {
    return;
  }
  BeanContext bc=getBeanContext();
  List<Layer> nonRemoveableLayers=new ArrayList<Layer>();
  for (  Layer layer : oldLayers) {
    if (layer != null) {
      if (layer.isRemovable()) {
        turnLayerOn(false,layer);
        layer.clearListeners();
        if (bc != null) {
          bc.remove(layer);
        }
      }
 else {
        nonRemoveableLayers.add(layer);
      }
    }
  }
  setLayerList(nonRemoveableLayers);
  System.gc();
}

public void removeAll ( ) { List < Layer > oldLayers = getLayerList ( ) ; if ( allLayers == null || allLayers . isEmpty ( ) ) { return ; } BeanContext bc = getBeanContext ( ) ; List < Layer > nonRemoveableLayers = new ArrayList < Layer > ( ) ; for ( Layer layer : oldLayers ) { if ( layer != null ) { if ( layer . isRemovable ( ) ) { turnLayerOn ( false , layer ) ; layer . clearListeners ( ) ; if ( bc != null ) { bc . remove ( layer ) ; } } else { nonRemoveableLayers . add ( layer ) ; } } } setLayerList ( nonRemoveableLayers ) ; System . gc ( ) ; }
remove all the layers ( that are marked as removable ) .
