Here you can find the source of removeAll(Preferences prefs, boolean deep)
public static void removeAll(Preferences prefs, boolean deep) throws BackingStoreException
//package com.java2s; /*//from w ww .java 2 s.c o m * PrefsUtil.java * Inertia * * Copyright (c) 2004-2005 Hanns Holger Rutz. All rights reserved. * * This software is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either * version 2, june 1991 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License (gpl.txt) along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * For further information, please contact Hanns Holger Rutz at * contact@sciss.de * * * Changelog: * 11-Aug-05 copied from de.sciss.eisenkraut.util.PrefsUtil */ import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; public class Main { /** * Traverse a preference node and optionally all * children nodes and remove any keys found. */ public static void removeAll(Preferences prefs, boolean deep) throws BackingStoreException { String[] keys; String[] children; int i; keys = prefs.keys(); for (i = 0; i < keys.length; i++) { prefs.remove(keys[i]); } if (deep) { children = prefs.childrenNames(); for (i = 0; i < children.length; i++) { removeAll(prefs.node(children[i]), deep); } } } }