You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
847 B
35 lines
847 B
1 year ago
|
/**
|
||
|
* File: built_in_hash.dart
|
||
|
* Created Time: 2023-06-25
|
||
|
* Author: liuyuxin (gvenusleo@gmail.com)
|
||
|
*/
|
||
|
|
||
|
import '../chapter_stack_and_queue/linkedlist_deque.dart';
|
||
|
|
||
|
/* Driver Code */
|
||
|
void main() {
|
||
|
int num = 3;
|
||
|
int hashNum = num.hashCode;
|
||
|
print("整数 $num 的哈希值为 $hashNum");
|
||
|
|
||
|
bool bol = true;
|
||
|
int hashBol = bol.hashCode;
|
||
|
print("布尔值 $bol 的哈希值为 $hashBol");
|
||
|
|
||
|
double dec = 3.14159;
|
||
|
int hashDec = dec.hashCode;
|
||
|
print("小数 $dec 的哈希值为 $hashDec");
|
||
|
|
||
|
String str = "Hello 算法";
|
||
|
int hashStr = str.hashCode;
|
||
|
print("字符串 $str 的哈希值为 $hashStr");
|
||
|
|
||
|
List arr = [12836, "小哈"];
|
||
|
int hashArr = arr.hashCode;
|
||
|
print("数组 $arr 的哈希值为 $hashArr");
|
||
|
|
||
|
ListNode obj = new ListNode(0);
|
||
|
int hashObj = obj.hashCode;
|
||
|
print("节点对象 $obj 的哈希值为 $hashObj");
|
||
|
}
|