What are legacy classes in the Java Collections framework, and why are they generally avoided in modern development?