public int getNrOfClasses ( ) { HashMap < Integer , Integer > classes = new HashMap < Integer , Integer > ( ) ; for ( DataObject currentObject : dataList ) { if ( ! classes . containsKey ( currentObject . getClassLabel ( ) ) ) classes . put ( currentObject . getClassLabel ( ) , 1 ) ; } return classes . size ( ) ; }
Counts the number of classes that are present in the data set . !!! It does not check whether all classes are contained !!!