So i can get hosted rooms nicely, but when listing them using their names it is a little disorganized. So i am trying to sort by the HostedRoom.GetName() needless to say i can't figure out how to do it. Heh...
here is an example of my attempt.
(Getiing error
The method sort(List<T>, Comparator<? super T>) in the type Collections is not applicable for the arguments (Collection<HostedRoom>, RoomList.CustomComparator)
under sort)
Collection<HostedRoom> rooms = null;
try {
rooms = MultiUserChat.getHostedRooms(GlobalVar.mConnection, "conference."+GlobalVar.mConnection.getServiceName());
} catch (XMPPException | NoResponseException | NotConnectedException e) {
e.printStackTrace();
}
Collections.sort(rooms, new CustomComparator());
class CustomComparator implements Comparator<HostedRoom> {
@Override
public int compare(HostedRoom o1, HostedRoom o2) {
return o1.getName().compareTo(o2.getName());
}
}