Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7248843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:11:44+00:00 2026-05-28T22:11:44+00:00

What is the difference between methods ## and hashCode ? They seem to be

  • 0

What is the difference between methods ## and hashCode?

They seem to be outputting the same values no matter which class or hashCode overloading I use. Google doesn’t help, either, as it cannot find symbol ##.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T22:11:44+00:00Added an answer on May 28, 2026 at 10:11 pm

    “Subclasses” of AnyVal do not behave properly from a hashing perspective:

    scala> 1.0.hashCode
    res14: Int = 1072693248
    

    Of course this is boxed to a call to:

    scala> new java.lang.Double(1.0).hashCode
    res16: Int = 1072693248
    

    We might prefer it to be:

    scala> new java.lang.Double(1.0).##
    res17: Int = 1
    
    scala> 1.0.##
    res15: Int = 1
    

    We should expect this given that the int 1 is also the double 1. Of course this issue does not arise in Java. Without it, we’d have this problem:

    Set(1.0) contains 1 //compiles but is false
    

    Luckily:

    scala> Set(1.0) contains 1
    res21: Boolean = true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the difference between the following class methods? Is it that one is
What's the difference between a class method and an instance method? Are instance methods
Whats the difference between class methods and Instance methods. Why do we need them
Is there any difference between these methods of declaring and setting a public class
I'm having a tough time understanding the difference between various methods of the com.google.gwt.core.client.Scheduler
What is the difference between these two methods that I believe do the same
What is the difference between anonymous methods of C# 2.0 and lambda expressions of
Could you explain the difference between setting methods in the constructor and through prototype
What's the difference between the list methods append() and extend() ?
Is there any difference between the 2 methods below for calculating c ... specifically

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.