4
Chew55
8y

3 hours in to work and I've already wished Java had two more features: native tuples and partial application in method references.

Comments
  • 2
    Don't try to implement it yourself, Oracle will sue you.
  • 1
    As much as I wish native tuples existed, the fact that it doesn't exist let's me think about whether or not that's the best thing to use. If a method returns a tuple, then all of the calling methods needs to know the implementation of it and what is stored in each "slot".

    I find it's usually better to have a (potentially inner) class with the variables you are trying to return. Then the client can simply use the getters. It's much easier to read that way. Especially a year from now when you forget what the tuple was.
  • 0
    I thought the same at first as well, and then I realize that tuples don't exist because they shouldn't in Java. You gotta commit.
  • 0
  • 1
    @temportalflux I have been using Kotlin on my own projects and have really liked it.
Add Comment