Method uses toArray() with zero-length array argument