Linked Questions

1 vote
0 answers
317 views

I understand it's possible, I just don't understand how. From what I can tell, if a class overrides the hashCode() and equals() methods to consider specified data members, references that instantiate ...
Matthew S.'s user avatar
253 votes
11 answers
240k views

Is there a limit to the number of elements a Java array can contain? If so, what is it?
Lizard's user avatar
  • 45.3k
154 votes
10 answers
83k views

I am just wondering why the Java 7 switch statement does not support a null case and instead throws NullPointerException? See the commented line below (example taken from the Java Tutorials article on ...
Prashant Bhate's user avatar
7 votes
5 answers
4k views

I understand that this seems to be already discussed and the answer is yes, String.hashCode can generate equal vales for different strings, but quite unlikely (Can Java's hashCode produce same ...
Ziqi's user avatar
  • 2,570
11 votes
4 answers
2k views

Had a discussion with an interviewer regarding internal implementation of Java Hashmaps and how it would behave if we override equals() but not the HashCode() method for an Employee<Emp_ID, ...
Sameer's user avatar
  • 817
5 votes
2 answers
2k views

I have short Strings (less than 10 characters). I will convert it into int and use it as primary key. (I can't use String primary key because of small problems.) I know the hashcodes of Strings of ...
Cinakyn's user avatar
  • 648
1 vote
2 answers
3k views

I'm trying to find a way to convert a long string ID like "T2hR8VAR4tNULoglmIbpAbyvdRi1y02rBX" to a numerical id. I thought about getting the ASCII value of each number and then adding them up but I ...
MoTahir's user avatar
  • 973
2 votes
2 answers
356 views

Is this sentence from an OCP book correct? A HashSet stores its elements in a hash table, which means the keys are a hash and the values are an Object. I have created below code snippet: class A { ...
bridgemnc's user avatar
  • 370
0 votes
2 answers
386 views

There are 10 fields in my database. In those 4 fields, 1 field is hash_attr. hash_attr is basically signifies whether incoming row is same or not with the row stored in database. If it is same we don'...
VJS's user avatar
  • 2,983
0 votes
1 answer
75 views

I was asked a question in which we're looking for duplicate social security numbers, as in ssn that are in both array A and also array B. My immediate thought was to iterate over each array storing ...
Elroy Jetson's user avatar