Is there a Pattern in Scala that can add a method to an Array object?
I am thinking of the implicit conversion of Int to RichInt. But that can’t be done as Array is a final class.
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.
As long as you avoid name collisions with any other implicit on
Array(e.g.ArrayOpsin 2.8, which adds the collections methods), you can extend using the normal implicit pimp-my-library pattern: