Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
836 lines (372 loc) · 25 KB
/
Copy pathindex.html
File metadata and controls
836 lines (372 loc) · 25 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
<!DOCTYPE html>
<html lang="zh-Hans">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>hashcode总结 | Lin 的博客</title>
<link href="/favicon.png" rel="shortcut icon" type="image/x-icon" />
<meta name="author" content="Lin" />
<meta name="description" content="Lin 的生活记录~" />
<meta name="generator" content="Hugo 0.119.0">
<link rel="canonical" href="https://recordnote.github.io/java/hashcode/" />
<meta property="og:title" content="hashcode总结" />
<meta property="og:description" content="一、hashcode是什么? 1、hash和hash表是什么? 想要知道这个hashcode,首先得知道hash,通过百度百科看一下 ha" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://recordnote.github.io/java/hashcode/" /><meta property="og:image" content="https://recordnote.github.io/me/background1.jpg"/><meta property="article:section" content="java" />
<meta property="article:published_time" content="2023-05-13T14:21:26+08:00" />
<meta property="article:modified_time" content="2023-05-13T14:21:26+08:00" />
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="https://recordnote.github.io/me/background1.jpg"/>
<meta name="twitter:title" content="hashcode总结"/>
<meta name="twitter:description" content="一、hashcode是什么? 1、hash和hash表是什么? 想要知道这个hashcode,首先得知道hash,通过百度百科看一下 ha"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
<link rel="stylesheet" href="/css/icomoon.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/overlayscrollbars@1.13.1/css/OverlayScrollbars.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css@4.0.0/github-markdown.min.css">
<link rel="stylesheet" href="/css/site.css" />
<style>
.ui.header a:not(.ui.button):hover {
text-decoration: underline;
}
a:not(.ui.button) {
color: seagreen !important;
}
.inverted a:not(.ui.button) {
color: darkseagreen !important;
}
body.default {
background-color: #fff;
background-image: url(/me/background1.jpg);
}
body.dark {
background-color: #333;
background-image: url(/me/background1.jpg);
}
</style>
<link rel="stylesheet" data-highlight href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/styles/tomorrow.min.css" />
<link rel="stylesheet" href="/css/custom.css" />
</head>
<body class="default">
<nav class="ui secondary menu dream-menu dream-nav">
<div class="item">
<i class="large link bullseye icon dream-flip-toggle" title="翻转!"></i>
</div>
<div class="item">
<i class="large link home icon" title="首页" onclick="window.location.href = 'https:\/\/recordnote.github.io'"></i>
</div>
<div class="item">
<i class="large link icon theme-switch" onclick="themeSwitch()"></i>
</div>
<div class="item">
<i class="large link search icon" onclick="toggleSearch()"></i>
</div>
</nav>
<div class="flip-container">
<div class="flipper">
<section class="front">
<div class="dream-max-width">
<div class="ui relaxed centered grid dream-grid dream-grid-single">
<aside class="sixteen wide mobile sixteen wide tablet three wide computer column dream-single-aside">
<div class="ui segment toc">
<nav id="TableOfContents">
<ul>
<li><a href="#一hashcode是什么">一、hashcode是什么?</a>
<ul>
<li><a href="#1hash和hash表是什么">1、hash和hash表是什么? </a></li>
<li><a href="#2hashcode">2、hashcode </a></li>
</ul>
</li>
<li><a href="#二hashcode有什么作用呢">二、hashcode有什么作用呢?</a></li>
<li><a href="#三equals方法和hashcode的关系">三、equals方法和hashcode的关系?</a></li>
<li><a href="#四为什么equals方法重写的话建议也一起重写hashcode方法">四、为什么equals方法重写的话,建议也一起重写hashcode方法?</a></li>
</ul>
</nav>
</div>
</aside>
<div class="sixteen wide mobile sixteen wide tablet ten wide computer column markdown-body dream-single" id="dream-save-post-as-img">
<section class="ui top attached segment">
<header>
<h1 class="ui large header">hashcode总结<span class="sub header">
<span class="left">
@
Lin
|
<span data-format="luxon">2023-05-13T14:21:26+08:00</span>
| 5 分钟阅读
| 更新于
<span data-format="luxon">2023-05-13T14:21:26+08:00</span>
</span>
<span class="dream-share">
<a href="#" class="save-as-image" title="保存为图片" onclick="savePostAsImg()">
<i class="save icon"></i>
</a>
<a href="https://twitter.com/intent/tweet?text=hashcode%e6%80%bb%e7%bb%93&url=https%3a%2f%2frecordnote.github.io%2fjava%2fhashcode%2f" title="Twitter">
<i class="twitter icon"></i>
</a>
<a href="https://facebook.com/sharer/sharer.php?u=https%3a%2f%2frecordnote.github.io%2fjava%2fhashcode%2f" title="Facebook">
<i class="facebook icon"></i>
</a>
</span>
</span>
</h1>
</header>
<article class="main">
<img class="cover" src="/img/java.png" />
<h2 id="一hashcode是什么">一、hashcode是什么?</h2>
<h3 id="1hash和hash表是什么">1、hash和hash表是什么? </h3>
<p> 想要知道这个hashcode,首先得知道hash,通过百度百科看一下</p>
<p> <img src="https://gitee.com/aaronlynn/picture/raw/master/img/image-20210714203416559.png" alt="img" style="zoom: 50%;" /></p>
<p> <img src="https://gitee.com/aaronlynn/picture/raw/master/img/874710-20161116202950092-1019467368.png" alt="img" style="zoom: 80%;" /></p>
<p> hash是一个函数,该函数中的实现就是一种算法,就是通过一系列的算法来得到一个hash值,这个时候,我们就需要知道另一个东西,hash表,通过hash算法得到的hash值就在这张hash表中,也就是说,hash表就是所有的hash值组成的,有很多种hash函数,也就代表着有很多种算法得到hash值,如上面截图的三种,等会我们就拿第一种来说。</p>
<h3 id="2hashcode">2、hashcode </h3>
<p> 有了前面的基础,这里讲解就简单了,hashcode就是通过hash函数得来的,通俗的说,就是通过某一种算法得到的,hashcode就是在hash表中有对应的位置。</p>
<p> 每个对象都有hashcode,对象的hashcode怎么得来的呢?</p>
<p> 首先一个对象肯定有物理地址,在别的博文中会hashcode说成是代表对象的地址,这里肯定会让读者形成误区,对象的物理地址跟这个hashcode地址不一样,hashcode代表对象的地址说的是对象在hash表中的位置,物理地址说的对象存放在内存中的地址,那么对象如何得到hashcode呢?通过对象的内部地址(也就是物理地址)转换成一个整数,然后该整数通过hash函数的算法就得到了hashcode,所以,hashcode是什么呢?就是在hash表中对应的位置。这里如果还不是很清楚的话,举个例子,hash表中有 hashcode为1、hashcode为2、(…)3、4、5、6、7、8这样八个位置,有一个对象A,A的物理地址转换为一个整数17(这是假如),就通过直接取余算法,17%8=1,那么A的hashcode就为1,且A就在hash表中1的位置。肯定会有其他疑问,接着看下面,这里只是举个例子来让你们知道什么是hashcode的意义。</p>
<h2 id="二hashcode有什么作用呢">二、hashcode有什么作用呢?</h2>
<p> 前面说了这么多关于hash函数,和hashcode是怎么得来的,还有hashcode对应的是hash表中的位置,可能大家就有疑问,为什么hashcode不直接写物理地址呢,还要另外用一张hash表来代表对象的地址?接下来就告诉你hashcode的作用,</p>
<p> 1、HashCode的存在主要是为了查找的快捷性,HashCode是用来在散列存储结构中确定对象的存储地址的(后半句说的用hashcode来代表对象就是在hash表中的位置)</p>
<p> 为什么hashcode就查找的更快,比如:我们有一个能存放1000个数这样大的内存中,在其中要存放1000个不一样的数字,用最笨的方法,就是存一个数字,就遍历一遍,看有没有相同得数,当存了900个数字,开始存901个数字的时候,就需要跟900个数字进行对比,这样就很麻烦,很是消耗时间,用hashcode来记录对象的位置,来看一下。hash表中有1、2、3、4、5、6、7、8个位置,存第一个数,hashcode为1,该数就放在hash表中1的位置,存到100个数字,hash表中8个位置会有很多数字了,1中可能有20个数字,存101个数字时,他先查hashcode值对应的位置,假设为1,那么就有20个数字和他的hashcode相同,他只需要跟这20个数字相比较(equals),如果每一个相同,那么就放在1这个位置,这样比较的次数就少了很多,实际上hash表中有很多位置,这里只是举例只有8个,所以比较的次数会让你觉得也挺多的,实际上,如果hash表很大,那么比较的次数就很少很少了。 通过对原始方法和使用hashcode方法进行对比,我们就知道了hashcode的作用,并且为什么要使用hashcode了</p>
<h2 id="三equals方法和hashcode的关系">三、equals方法和hashcode的关系?</h2>
<p> 通过前面这个例子,大概可以知道,先通过hashcode来比较,如果hashcode相等,那么就用equals方法来比较两个对象是否相等,用个例子说明:上面说的hash表中的8个位置,就好比8个桶,每个桶里能装很多的对象,对象A通过hash函数算法得到将它放到1号桶中,当然肯定有别的对象也会放到1号桶中,如果对象B也通过算法分到了1号桶,那么它如何识别桶中其他对象是否和它一样呢,这时候就需要equals方法来进行筛选了。</p>
<p> 1、如果两个对象equals相等,那么这两个对象的HashCode一定也相同</p>
<p> 2、如果两个对象的HashCode相同,不代表两个对象就相同,只能说明这两个对象在散列存储结构中,存放于同一个位置</p>
<p>这两条你们就能够理解了。</p>
<h2 id="四为什么equals方法重写的话建议也一起重写hashcode方法">四、为什么equals方法重写的话,建议也一起重写hashcode方法?</h2>
<p> 如果对象的equals方法被重写,那么对象的HashCode方法也尽量重写)</p>
<p> 举个例子,其实就明白了这个道理,</p>
<p> 比如:有个A类重写了equals方法,但是没有重写hashCode方法,看输出结果,对象a1和对象a2使用equals方法相等,按照上面的hashcode的用法,那么他们两个的hashcode肯定相等,但是这里由于没重写hashcode方法,他们两个hashcode并不一样,所以,我们在重写了equals方法后,尽量也重写了hashcode方法,通过一定的算法,使他们在equals相等时,也会有相同的hashcode值。</p>
<p> <img src="https://gitee.com/aaronlynn/picture/raw/master/img/874710-20161116212819810-31016841.png" alt="img"></p>
<p> 实例:现在来看一下String的源码中的equals方法和hashcode方法。这个类就重写了这两个方法,现在为什么需要重写这两个方法了吧?</p>
<p> equals方法:其实跟我上面写的那个例子是一样的原理,所以通过源码又知道了String的equals方法验证的是两个字符串的值是否一样。还有Double类也重写了这些方法。很多类有比较这类的,都重写了这两个方法,因为在所有类的父类Object中。equals的功能就是 “==”号的功能。你们还可以比较String对象的equals和==的区别啦。这里不再说明。</p>
<p><img src="https://gitee.com/aaronlynn/picture/raw/master/img/874710-20161116213248701-1976448309.png" alt="img"></p>
<p> hashcode方法<img src="https://gitee.com/aaronlynn/picture/raw/master/img/874710-20161116213322170-1989555882.png" alt="img"></p>
</article>
</section>
<article class="ui segment utterances-comments" data-html2canvas-ignore>
<script
src="https://utteranc.es/client.js"
repo="recordnote/recordnote.github.io"
issue-term="og:title"
theme="github-light"
crossorigin="anonymous"
async>
</script>
</article>
</div>
</div>
<footer class="ui basic center aligned segment" style="background-color: transparent;">
<p>© 2019 - 2026 Lin 的博客</p>
<p>Powered by <a href="https://gohugo.io/" target="_blank">Hugo</a> with theme <a href="https://github.com/g1eny0ung/hugo-theme-dream" target="_blank">Dream</a>.</p>
</footer>
</div>
</section>
<section class="back">
<div class="dream-max-width">
<header class="ui basic very padded segment dream-header">
<div class="ui small circular image">
<img src="/me/yy.jpg" alt="avatar" />
</div>
<div class="content">
<h1 class="ui medium header">
Lin 的博客
<span class="sub header">A merry heart goes all the way.</span>
</h1>
<nav class="ui horizontal list" aria-label="博客导航">
<a class="item" href="/posts" aria-label="归档">
<i class="archive icon" aria-hidden="true"></i>
</a>
<a class="item" href="/categories" aria-label="所有分类">
<i class="th list icon" aria-hidden="true"></i>
</a>
<a class="item" href="/tags" aria-label="所有标签">
<i class="tags icon" aria-hidden="true"></i>
</a>
</nav>
<nav class="dream-topic-nav" aria-label="文章主题">
<div class="dream-tags dream-tags-primary">
<a class="ui label" href="/tags/agent/">Agent</a>
<a class="ui label" href="/tags/ai%E5%BA%94%E7%94%A8/">AI应用</a>
<a class="ui label" href="/tags/java/">Java</a>
<a class="ui label" href="/tags/%E6%9E%B6%E6%9E%84%E8%AE%BE%E8%AE%A1/">架构设计</a>
<a class="ui label" href="/tags/rag/">RAG</a>
<a class="ui label" href="/tags/%E5%BE%AE%E6%9C%8D%E5%8A%A1/">微服务</a>
</div>
<details class="dream-tags-more">
<summary>更多主题 <span>(7)</span></summary>
<div class="dream-tags dream-tags-secondary">
<a class="ui label" href="/tags/%E6%95%B0%E6%8D%AE%E5%BA%93/">数据库</a>
<a class="ui label" href="/tags/%E6%B6%88%E6%81%AF%E9%98%9F%E5%88%97/">消息队列</a>
<a class="ui label" href="/tags/%E5%AE%89%E5%85%A8/">安全</a>
<a class="ui label" href="/tags/%E7%94%9F%E6%B4%BB%E9%9A%8F%E7%AC%94/">生活随笔</a>
<a class="ui label" href="/tags/%E7%AE%97%E6%B3%95%E4%B8%8E%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/">算法与数据结构</a>
<a class="ui label" href="/tags/%E5%89%8D%E7%AB%AF/">前端</a>
<a class="ui label" href="/tags/%E8%BF%90%E7%BB%B4/">运维</a>
</div>
</details>
</nav>
</div>
</header>
<div class="ui relaxed grid dream-grid dream-back">
<div class="sixteen wide mobile eight wide tablet four wide computer column dream-column">
<article class="ui segment markdown-body">
<div class="ui medium header">关于我</div>
<p>Lin 的 ❤️ 博客</p>
<p>技术专题:<a href="/agent-engineering/overview/">Java Agent 工程化:从知识库问答到可靠业务执行</a>。围绕 RAG、工具治理、任务恢复与 Java 平台架构整理设计思路和验证方法。</p>
<p>记录一些 🌈 生活上,技术上的事</p>
<ul>
<li><strong>🛠️ 技术阵地:</strong> 深耕 Java 开发 ,目前向 AI 应用领域探索与拓展。这里主要记录我从后端架构到 AI 赋能的进阶之路、技术思考以及日常的 debug 血泪史。始终致力于写出优雅且没有 bug 的代码(尽量)。</li>
<li><strong>🌈 生活侧写:</strong> 偶尔脱下极客的外衣,我也会在这里分享生活中的灵光一现。不管是好用的效率工具,还是周末的一场骑行,都是构成我真实生活的一部分。</li>
</ul>
</article>
</div>
<div class="sixteen wide mobile eight wide tablet four wide computer column dream-column">
<article class="ui segment">
<div class="ui medium header">社交链接</div>
<nav class="ui secondary menu dream-menu dream-socials">
<div class="item">
<a href="/index.xml">
<i class="large rss square icon" title="RSS"></i>
</a>
</div>
<div class="item">
<a href="mailto:zhjlynn@foxmail.com">
<i class="large mail icon" title="Email"></i>
</a>
</div>
<div class="item">
<a href="https://twitter.com/Lin" target="_blank">
<i class="large twitter icon" title="Twitter"></i>
</a>
</div>
<div class="item">
<a href="https://facebook.com/Lin" target="_blank">
<i class="large facebook icon" title="Facebook"></i>
</a>
</div>
<div class="item">
<a href="https://instagram.com/Lin" target="_blank">
<i class="large instagram icon" title="Instagram"></i>
</a>
</div>
<div class="item">
<a href="https://www.linkedin.com/in/Lin" target="_blank">
<i class="large linkedin icon" title="Linkedin"></i>
</a>
</div>
<div class="item">
<a href="https://github.com/Lin" target="_blank">
<i class="large github icon" title="GitHub"></i>
</a>
</div>
<div class="item">
<a href="https://www.stackoverflow.com/users/Lin" target="_blank">
<i class="large stack overflow icon" title="StackOverflow"></i>
</a>
</div>
</nav>
</article>
</div>
<div class="sixteen wide mobile eight wide tablet four wide computer column dream-column">
<article class="ui segment">
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="知识共享许可协议" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br />本作品采用<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议</a>进行许可。<br /><br />背景使用了 <a href="https://www.pexels.com/zh-cn/" target="_blank">Pexels</a> 上 <a href="https://www.pexels.com/zh-cn/Ungaro" target="_blank">Francesco Ungaro</a> 拍摄的<a href="https://www.pexels.com/zh-cn/photo/1454794/" target="_blank">图片</a>。
</article>
</div>
</div>
</div>
</section>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0"></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
<div class="ui segment" id="dream-search">
<div class="ui search">
<div class="ui transparent input">
<input class="prompt" type="text" placeholder="搜索" />
</div>
<div class="results"></div>
</div>
</div>
<script>
$(document).ready(function () {
$.getJSON('https:\/\/recordnote.github.io/index.json', function (data) {
$('.ui.search').search({
source: data,
searchFields: ['title'],
showNoResults: false,
})
})
})
</script>
<script src="/js/search.js"></script>
<script>
window.background = "#fff"
window.defaultDark = null
window.backgroundDark = "#333"
window.backgroundImageDark = "/me/background1.jpg"
window.darkNav = null
window.maxTags = 6
window.hasTwitterEmbed = null
window.fixedNav = true
if (window.hasTwitterEmbed) {
window.twttr = (function (d, s, id) {
var js,
fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {}
if (d.getElementById(id)) return t
js = d.createElement(s)
js.id = id
js.src = 'https://platform.twitter.com/widgets.js'
fjs.parentNode.insertBefore(js, fjs)
t._e = []
t.ready = function (f) {
t._e.push(f)
}
return t
})(document, 'script', 'twitter-wjs')
}
</script>
<script src="https://cdn.jsdelivr.net/npm/overlayscrollbars@1.13.1/js/jquery.overlayScrollbars.min.js"></script>
<script src="/js/header.js"></script>
<script src="/js/main.js"></script>
<script src="/js/theme.js"></script>
<script src="https://cdn.jsdelivr.net/npm/luxon@1.26.0"></script>
<script>
format()
function format() {
$('span[data-format="luxon"]').each(function () {
var date = $(this).text()
$(this).text(luxon.DateTime.fromISO(date, { locale: "zh" }).toFormat("yyyy年MM月dd日"))
})
}
</script>
<script src="/js/scrollToTop.js"></script>
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/highlight.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/languages/clojure.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/languages/ocaml.min.js"></script>
<script>
hljs.highlightAll()
setHighlightTheme()
function setHighlightTheme() {
var isDark = localStore.getItem('hugo-theme-dream-is-dark')
isDark = isDark ? isDark : window.defaultDark ? 'y' : isDark
var lightTheme = "tomorrow"
var darkTheme = "tomorrow-night"
var theme = isDark === 'y' ? darkTheme : lightTheme
$('link[data-highlight]').attr('href', 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release/build/styles/' + theme + '.min.css')
$('pre').css('background', isDark === 'y' ? '#333' : '')
}
</script>
<script src="https://cdn.jsdelivr.net/npm/html2canvas@1.0.0-rc.1"></script>
<script src="/js/post.js" defer></script>
<script type="application/javascript">
var doNotTrack = false;
if (!doNotTrack) {
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-98295641-1', 'auto');
ga('send', 'pageview');
}
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
</body>
</html>