Commit dcfdb057 by Liv Haapala

Adding sort to product\'s options list

1 parent 38b4bea9
...@@ -24,6 +24,7 @@ package fi.codecrew.moya.model; ...@@ -24,6 +24,7 @@ package fi.codecrew.moya.model;
import javax.persistence.*; import javax.persistence.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
...@@ -87,6 +88,11 @@ public class ProductOptionGroup extends GenericEntity implements Cloneable { ...@@ -87,6 +88,11 @@ public class ProductOptionGroup extends GenericEntity implements Cloneable {
} }
public List<ProductOption> getOptions() { public List<ProductOption> getOptions() {
Collections.sort(options, (po1, po2) ->{
return po1.getPriority() - po2.getPriority();
} );
return options; return options;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!