private static void expand(List<DoubleVector> points,
DistanceMeasurer measurer, TIntHashSet visited, TIntArrayList neighbours,
List<DoubleVector> currentCluster, double epsilon, int minPoints) {
TIntHashSet currentNeighbours = new TIntHashSet();
currentNeighbours.addAll(currentNeighbours);
// note that neighbours is growing while we are iterating over it
for (int i = 0; i < neighbours.size(); i++) {
int neighbour = neighbours.get(i);
if (!visited.contains(neighbour)) {
visited.add(neighbour);