/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package mytime.bll; import java.util.Collections; import java.util.Comparator; import java.util.List; import javafx.scene.Node; import mytime.be.Group; import mytime.be.Volunteer; /** * * @author Stefan-VpcEB3J1E */ public class SortingStrategyGuildsAlphabetic implements SortingStrategy { @Override public List<Node> sort(List<Node> listToSort) { List<Node> newList = listToSort; Collections.sort(newList, new Comparator<Node>() { @Override public int compare(Node s1, Node s2) { Group v1 = (Group) s1.getUserData(); Group v2 = (Group) s2.getUserData(); return v1.getName().get().compareTo(v2.getName().get()); } }); return newList; } }