You can just return the inverse of your conditional: return currentTrainingSetSize < allTrainingData.size();