-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashtables
More file actions
83 lines (27 loc) · 1.78 KB
/
Hashtables
File metadata and controls
83 lines (27 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
Hashtable in Java
This class implements a hash table, which maps keys to values. Any non-null object can be used as a key or as a value.
To successfully store and retrieve objects from a hashtable, the objects used as keys must implement the hashCode method and the equals
method.
It is similar to HashMap, but is synchronised.
Hashtable stores key/value pair in hash table.
In Hashtable we specify an object that is used as a key, and the value we want to associate to that key. The key is then hashed, and the
resulting hash code is used as the index at which the value is stored within the table.
Constructors:
Hashtable(): This is the default constructor.
Hashtable(int size): This creates a hash table that has initial size specified by size.
Hashtable(int size, float fillRatio): This version creates a hash table that has initial size specified by size and fill ratio specified
by fillRatio. fill ratio: Basically it determines how full hash table can be before it is resized upward.and its Value lie between 0.0 to
1.0
Hashtable(Map m): This creates a hash table that is initialised with the elements in m.
Methods:
void clear() : method clears the hashtable so that it contains no keys.
Syntax : public void clear()
Returns : NA
Exception : NA
Object clone() : used to create a shallow copy of this hashtable.
Syntax : public Object clone()
Returns :method call returns a clone of the hashtable.
Exception : NA
*/
/* Hashtables are used to check if a file is copied well enough from its source to destination folder */