No, object required, hash code does not suffice
How can I remove an item by its hashCode, without knowing the object itself?
You cannot.
The hash code is only the first step in tracking an object within a HashSet or HashMap.
Hash codes are not necessarily unique. Two different objects may coincidentally have the same hash code result. Such collisions are expected.
So a hash-based collection is built to secondarily track the colliding objects as a group, and work through them by using the equals method. Equality is used to differentiate between objects that happen to produce the same hash code calculation result.
So you cannot retrieve an object from a hash-driven collection using only its hash code calculated value. The original object is needed for the equality test.
And this explains why your equals and hashCode methods must use mutually consistent logic. And, of course, never override one without overriding the other.
See: How does a Java HashMap handle different objects with the same hash code?.
Map
If you want to track objects for speedy retrieval by a particular property of that class such as a unique identifier, use a Map rather than a Set. A map tracks key-value pairings.
For example, we want to track each person by their assigned identifier, a UUID.
record Person ( UUID id , String name , String phone ) {}
So we define a mapping of UUID to Person.
Map< UUID , Person > map = new HashMap<>() ;
Instantiate an object of that class.
UUID id = UUID.fromString( "5595d84e-b86b-11eb-8529-0242ac130003" ) ;
Person alice = new Person( id , "Alice" , "555-1234" ) ;
Add a Person object to the map.
map.put( alice.id() , alice ) ;
Retrieve.
Person x = map.get( UUID.fromString( "5595d84e-b86b-11eb-8529-0242ac130003" ) ) ;