File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727

2828
public class ListCompression extends Chromosome<ListCompression> {
2929

30+
private static final List<String> ORIGINAL_LIST = List.of("Michael", "Sarah", "Joshua", "Narine",
31+
"David", "Sajid", "Melanie", "Daniel", "Wei", "Dean", "Brian", "Murat", "Lisa");
3032
private List<String> myList;
3133
private Random random;
3234

@@ -36,8 +38,7 @@ public ListCompression(List<String> list) {
3638
}
3739

3840
public static ListCompression randomInstance() {
39-
ArrayList<String> tempList = new ArrayList<>(List.of("Michael", "Sarah", "Joshua", "Narine", "David", "Sajid",
40-
"Melanie", "Daniel", "Wei", "Dean", "Brian", "Murat", "Lisa"));
41+
ArrayList<String> tempList = new ArrayList<>(ORIGINAL_LIST);
4142
Collections.shuffle(tempList);
4243
return new ListCompression(tempList);
4344
}
@@ -96,9 +97,7 @@ public String toString() {
9697
}
9798

9899
public static void main(String[] args) {
99-
ListCompression originalOrder = new ListCompression(
100-
List.of("Michael", "Sarah", "Joshua", "Narine", "David", "Sajid",
101-
"Melanie", "Daniel", "Wei", "Dean", "Brian", "Murat", "Lisa"));
100+
ListCompression originalOrder = new ListCompression(ORIGINAL_LIST);
102101
System.out.println(originalOrder);
103102
ArrayList<ListCompression> initialPopulation = new ArrayList<>();
104103
final int POPULATION_SIZE = 100;

0 commit comments

Comments
 (0)