More groovifed way of sublist with varying range
You could start with:

def groups = [:]
teacherNodes.each { teacher -&gt;
    groups[teacher] = studentNodes.take(incrementBy)
    studentNodes    = studentNodes.drop(incrementBy) 
}