r/java • • Jul 16 '26

Identifying JDK value class candidates

https://mail.openjdk.org/archives/list/core-libs-dev@openjdk.org/thread/Y72NRXM7KYBX43OKYBQMVKOZDWKG4MHS/
54 Upvotes

59 comments sorted by

View all comments

Show parent comment

10

u/__konrad Jul 16 '26

Map.Entry has also a value-based implementation (Map::entry method returns immutable KeyValueHolder)

6

u/davidalayachew Jul 16 '26

Map.Entry has also a value-based implementation (Map::entry method returns immutable KeyValueHolder)

This is a much better candidate. Yes, the KeyValueHolder class returned by Map.entry(key, value) could definitely be a value class.