Created
August 10, 2016 07:30
-
-
Save c0rp-aubakirov/60e9dfb720f1979e769c23bf64c5997b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum CrossoverType { | |
ONE_POINT_CROSSOVER, TWO_POINT_CROSSOVER, UNIFORM_CROSSOVER, VAR_TO_VAR_CROSSOVER; | |
/** | |
* | |
* @param value should represent one of enum in CrossoverType | |
* @return return suited CrossoverType or ONE_POINT_CROSSOVER of nothing is found | |
*/ | |
public static CrossoverType parse(String value) { | |
final List<CrossoverType> list = Arrays.asList(CrossoverType.values()); | |
return list.stream().filter(m -> m.name().equals(value)).findAny().orElse(ONE_POINT_CROSSOVER); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment