The Nearest-Neighbor Technique for Particle Identification