Should I implement named parameters in Java using Hash tables?
I saw this entry:
: but I did not want to use the builder method which seemed overly verbose
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no such thing as named parameters in Java.
There are workarounds and there have been submissions in Project Coin but they were rejected. Sun is well aware that there is a demand but, so far, they have rejected any such language change.
Using Maps as suggested above is a possibility but unless all your arguments have the same type, it is cumbersome. And it’s not really efficient either.