Operator overloading for collections?
david Grajales
david.1993grajales at gmail.com
Thu Aug 21 23:01:41 UTC 2025
Dear Amber team,
I hope this message finds you well.
I recently watched Brian’s talk "Growing the java language" and I found the
discussion on operator overloading particularly interesting. I appreciated
how the proposed approach allows operator overloading in a more restricted
and safer way, by enforcing algebraic laws.
This immediately made me think about potential use cases for
collections—for example, using operators for union (+), difference (-),
exclusion, and similar operations. However, since this feature is intended
to be limited to value classes, and the current collection classes are not
value-based, it seems they would not benefit from these new operator
overloading capabilities.
My question is: are there any plans to enhance the collections framework
with value-class-based variants, so that they could take advantage of this
feature? Or is this idea (or any other related to the use case) not
currently under consideration?
I know this is still under discussion, I am just curious about this
particular use case.
Thank you very much for your work and for your time.
Best regards, and always yours.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20250821/d58ed252/attachment-0001.htm>
More information about the amber-dev
mailing list