java - JavaFX Character Comparator for TableColumn -


any idea why comparator not comparing? , never goes 1 of if-statements. if click on column header, nothing happens.

example characters: {'g','c','null','b','null','a'}

i want sorted, null values come after character values.

sorted: a,b,c,g,null,null

nullcomparator.java

package de.hhn.pp.todomanager.model;  import java.util.comparator;  public class nullcomparator implements comparator<character> {      @override     public final int compare(final character o1, final character o2) {          if (o1 == null && o2 == null) {             system.out.println(                     "if1");             return 0;         }          if (o1 == null) {             system.out.println(                     "if2");             return 1;         }          if (o2 == null) {             system.out.println(                     "if3");             return -1;         }         system.out.println("passed ifs");          return o1.compareto(o2);  //edited     } } 

mainviewcontroller.java

tablecolumn<taskcontrol, character> colprioritaet; private tableview<taskcontrol> tblview;   colprioritaet                 .setcellvaluefactory(new propertyvaluefactory<>("priority"));         colprioritaet.setcomparator(new nullcomparator()); 

taskcontrol.java

private char priority; 


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -