Move from list to linked set for order conservation and use efficiency

This commit is contained in:
Emmanuel Bigeon 2018-10-11 11:33:15 -04:00
parent 438727e7b9
commit f8da1c0119

View File

@ -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<ICommand> commands;
private static final String SPACE = " "; //$NON-NLS-1$
/** The commands set.
* <p>
* The insertion order is conserved through the use of a
* {@link LinkedHashSet}. */
protected final Set<ICommand> commands;
/** Create a command provider. */
public CommandProvider() {
super();
commands = new ArrayList<>();
commands = new LinkedHashSet<>();
}
/** Test the command name validity.