diff --git a/gclc/src/main/java/net/bigeon/gclc/command/CommandProvider.java b/gclc/src/main/java/net/bigeon/gclc/command/CommandProvider.java index 1d23ac4..c2d22b6 100644 --- a/gclc/src/main/java/net/bigeon/gclc/command/CommandProvider.java +++ b/gclc/src/main/java/net/bigeon/gclc/command/CommandProvider.java @@ -35,8 +35,8 @@ package net.bigeon.gclc.command; * knowledge of the CeCILL license and that you accept its terms. * #L% */ -import java.util.ArrayList; -import java.util.List; +import java.util.LinkedHashSet; +import java.util.Set; import net.bigeon.gclc.exception.CommandRunException; import net.bigeon.gclc.exception.InvalidCommandName; @@ -49,16 +49,19 @@ import net.bigeon.gclc.manager.ConsoleOutput; * @author Emmanuel BIGEON */ public class CommandProvider implements ICommandProvider { /** The minus character. */ - private static final String MINUS = "-"; //$NON-NLS-1$ + private static final String MINUS = "-"; //$NON-NLS-1$ /** The space character. */ - private static final String SPACE = " "; //$NON-NLS-1$ - /** The commands map. */ - protected final List commands; + private static final String SPACE = " "; //$NON-NLS-1$ + /** The commands set. + *

+ * The insertion order is conserved through the use of a + * {@link LinkedHashSet}. */ + protected final Set commands; /** Create a command provider. */ public CommandProvider() { super(); - commands = new ArrayList<>(); + commands = new LinkedHashSet<>(); } /** Test the command name validity.