package com.fwdekker.randomness.string;

import java.util.Collection;
import java.util.stream.Collectors;


/**
 * An {@code Alphabet} represents a collection of symbols.
 */
enum Alphabet {
    ALPHABET("Alphabet (a, b, c, ...)", "abcdefghijklmnopqrstuvwxyz"),
    HEXADECIMAL("Hexadecimal (0, 1, 2, ..., d, e, f)", "0123456789abcdef"),
    DIGITS("Digits (0, 1, 2, ...)", "0123456789"),
    MINUS("Minus (-)", "-"),
    UNDERSCORE("Underscore (_)", "_"),
    SPACE("Space ( )", " "),
    SPECIAL("Special (!, @, #, $, %, ^, &, *)", "!@#$%^&*"),
    BRACKETS("Brackets ((, ), [, ], {, }, <, >)", "()[]{}<>");


    /**
     * The name of the alphabet.
     */
    private final String name;
    /**
     * The symbols in the alphabet.
     */
    private final String symbols;


    /**
     * Constructs a new {@code Alphabet}.
     *
     * @param name    the name of the alphabet
     * @param symbols the symbols in the alphabet
     */
    Alphabet(final String name, final String symbols) {
        this.name = name;
        this.symbols = symbols;
    }


    /**
     * Concatenates the symbols of all the alphabets in the given collection.
     *
     * @param alphabets a collection of alphabets
     * @return the concatenation of all symbols of all the alphabets in the given collection
     */
    static String concatenate(final Collection<Alphabet> alphabets) {
        return alphabets.stream()
                .map(Alphabet::getSymbols)
                .collect(Collectors.joining());
    }


    /**
     * Returns the name of the alphabet.
     *
     * @return the name of the alphabet
     */
    String getName() {
        return name;
    }

    /**
     * Returns the symbols in the alphabet.
     *
     * @return the symbols in the alphabet
     */
    String getSymbols() {
        return symbols;
    }

    @Override
    public String toString() {
        return name;
    }
}

@@ -251,24 +251,75 @@
 stuvwxyz%22),%0A
+    DIGITS(%22Digits (0, 1, 2, ...)%22, %220123456789%22),%0A
     HEXADECI
@@ -386,59 +386,8 @@
 %22),%0A
-    DIGITS(%22Digits (0, 1, 2, ...)%22, %220123456789%22),%0A
     

Change order of alphabets