Java's Set collections prevent duplicates by using the add method. Instead of throwing an exception, Set.add() simply returns false if the element is already present, indicating that the collection was not modified. It does not produce compile-time or runtime errors for duplicate additions.