Questions tagged [hashcode]

A hash code is a result of applying a hash function to data, usually resulting in an integer.

2025 questions
0
votes
1 answer

CHECKSUM_AGG(checksum()) returns stars (**********)

I am calling id int , tableid int, seid int, ptid int, VISID NVARCHAR(50), Tname AS SYSNAME , ColumnValue NVARCHAR(50), ColumnKey NVARCHAR(50), @HashValue NVARCHAR(50) OUTPUT select @HashValue = CHECKSUM_AGG(checksum(id,tableid, seid, ptid, VISID,…
aggicd
  • 727
  • 6
  • 28
0
votes
0 answers

How to prevent HashMap to store duplicate Object type value and returns the existing value reference?

I have below program snippet. public class MapKeyAsAnObject { public static void main(String[] args) { Employee e1 = new Employee(1, "abc"); // P Employee e2 = new Employee(2, "xyz"); Map map = new…
arjun kumar
  • 467
  • 5
  • 12
0
votes
0 answers

Clear understanding of java equals method

What happens if my equals method (overridden in employee class - which is acting as key) always returns true (hardcoded) or always returns false? Also similary, can I user Math.random as hashcode? Why or why cant i do that?
Imran Moosani
  • 41
  • 1
  • 5
0
votes
2 answers

I'm setting up facebook Account Kit SMS Authentication, Is it necessary to generate hash key?

Can I just get app id and facebook account kit from facebook developers ? I launch The Command Prompt and go to my java bin directory and execute the following command : keytool -exportcert -alias androiddebugkey -keystore…
0
votes
1 answer

HashCode generation by Eclipse using redundant result field

I am considering using Eclipse generated HashCode and I have a basic doubt (using it for the first time). Why does the hashCode in the below code snippet use the result field? I feel it is redundant and would like to understand what possible reasons…
HopeKing
  • 3,317
  • 7
  • 39
  • 62
0
votes
1 answer

Can an interface method be overridden with a different Number return type?

I have a lab for data structures and the teacher asks me "create 'class IpAddressValueHasher implements Hasher' so when you override hash(IpAddress) it returns a Long object for the parameter's ipValue's call to hashCode. The problem is that I don't…
Collin Hurst
  • 63
  • 10
0
votes
2 answers

How to implement a compareTo() method when consistent with Equal and hashcode

I have a class Product, which three variables: class Product implements Comparable{ private Type type; // Type is an enum Set attributes; // Attribute is a regular class ProductName name; …
user697911
  • 10,043
  • 25
  • 95
  • 169
0
votes
1 answer

How the hashCode() and equals() overriding actually works?

I just read from a book and it said that as long as we override an equals() method from the Object class, its hashCode() method should be overriden also, but I do not really understand why we have to override the hashCode() method also. Let's…
Ock
  • 1,262
  • 3
  • 18
  • 38
0
votes
2 answers

sample same 1 million records in two applications with same logic

I have two different applications which are running on two different machines. Application A is receiving data from Source A. Application B is receiving data from Source B. Technically Source A and Source B are supposed to provide same data.…
user1813228
0
votes
3 answers

"contains" method with Set does not work even after overriding the equals method

There is an entity : @Entity @Table(name = "menu") public class Menu { @Id @SequenceGenerator(name="s_menu", sequenceName="s_menu", allocationSize=1) @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="s_menu") @Column(name…
pheromix
  • 18,213
  • 29
  • 88
  • 158
0
votes
0 answers

What's a good hash code for this

I have been going through the Reinforcement question in the textbook Data Structures and Algorithms in Java, 6th Edition, and came across this question: "What would be a good hash code for a vehicle identification number that is a string of numbers…
kprog
  • 59
  • 2
  • 8
0
votes
1 answer

Do I need to override also hashCode and equals methods with compareTo method?

I want the FeatureEntryKey used as a Map Key, which depends on the two strings. I remember by default String values can handle equality well, so there is no need to auto-generate the two methods here. Is that true? public class FeatureEntryKey…
user697911
  • 10,043
  • 25
  • 95
  • 169
0
votes
2 answers

Non-value field is accessed in 'hashCode()'

It happen with id. (Non-value field is accessed in 'hashCode()') How can I fix it? Here is my code: import java.util.Date case class Category() { var id: Integer = _ var parentId: Integer = _ var name: String = _ var status: Boolean…
AurevoirXavier
  • 2,543
  • 2
  • 17
  • 25
0
votes
1 answer

hashcode implementation based on the Object Class

hi guys i have a little problem here to solve. I have created an equals() method which is only based on the class of the object so that if two obj are of the same class the obj1.equals(obj2) return true. now my question is, How do i implement a…
Davide
  • 90
  • 10
0
votes
1 answer

Can GetHashCode() for the same double result in a different integer?

Is it possible for the GetHashCode() method to return different integer values for the same double value on different computers, operating systems, or architectures? For example, if I have the following code: public unsafe override int…
Vahid
  • 5,144
  • 13
  • 70
  • 146
1 2 3
99
100