-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
332 lines (265 loc) · 39 KB
/
index.html
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
<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>JIEB - JIE HEXO</title><meta name="author" content="John Jie"><meta name="copyright" content="John Jie"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="ffffff"><meta name="description" content="HEXO JIE">
<meta property="og:type" content="website">
<meta property="og:title" content="JIEB">
<meta property="og:url" content="http://example.com/index.html">
<meta property="og:site_name" content="JIEB">
<meta property="og:description" content="HEXO JIE">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://baojieangel.github.io/img/bj.png">
<meta property="article:author" content="John Jie">
<meta property="article:tag" content="love lan">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://baojieangel.github.io/img/bj.png"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="http://example.com/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
root: '/',
algolia: undefined,
localSearch: {"path":"/search.xml","preload":true,"languages":{"hits_empty":"找不到您查询的内容:${query}"}},
translate: undefined,
noticeOutdate: {"limitDay":500,"position":"top","messagePrev":"It has been","messageNext":"days since the last update, the content of the article may be outdated."},
highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":230},
copy: {
success: '复制成功',
error: '复制错误',
noSupport: '浏览器不支持'
},
relativeDate: {
homepage: true,
post: true
},
runtime: '',
date_suffix: {
just: '刚刚',
min: '分钟前',
hour: '小时前',
day: '天前',
month: '个月前'
},
copyright: undefined,
lightbox: 'fancybox',
Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#1f1f1f","position":"top-right"},
source: {
justifiedGallery: {
js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
}
},
isPhotoFigcaption: false,
islazyload: true,
isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
title: 'JIEB',
isPost: false,
isHome: true,
isHighlightShrink: false,
isToc: false,
postUpdate: '2024-03-22 15:48:11'
}</script><noscript><style type="text/css">
#nav {
opacity: 1
}
.justified-gallery img {
opacity: 1
}
#recent-posts time,
#post-meta time {
display: inline !important
}
</style></noscript><script>(win=>{
win.saveToLocal = {
set: function setWithExpiry(key, value, ttl) {
if (ttl === 0) return
const now = new Date()
const expiryDay = ttl * 86400000
const item = {
value: value,
expiry: now.getTime() + expiryDay,
}
localStorage.setItem(key, JSON.stringify(item))
},
get: function getWithExpiry(key) {
const itemStr = localStorage.getItem(key)
if (!itemStr) {
return undefined
}
const item = JSON.parse(itemStr)
const now = new Date()
if (now.getTime() > item.expiry) {
localStorage.removeItem(key)
return undefined
}
return item.value
}
}
win.getScript = url => new Promise((resolve, reject) => {
const script = document.createElement('script')
script.src = url
script.async = true
script.onerror = reject
script.onload = script.onreadystatechange = function() {
const loadState = this.readyState
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
script.onload = script.onreadystatechange = null
resolve()
}
document.head.appendChild(script)
})
win.activateDarkMode = function () {
document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
}
}
win.activateLightMode = function () {
document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', 'ffffff')
}
}
const t = saveToLocal.get('theme')
if (t === 'dark') activateDarkMode()
else if (t === 'light') activateLightMode()
const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
if (asideStatus === 'hide') {
document.documentElement.classList.add('hide-aside')
} else {
document.documentElement.classList.remove('hide-aside')
}
}
const detectApple = () => {
if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
document.documentElement.classList.add('apple')
}
}
detectApple()
})(window)</script><meta name="generator" content="Hexo 6.3.0"></head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">66</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 列表</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('https://baojieAngel.github.io/img/bj4.png')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">JIEB</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 列表</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">JIEB</h1><div id="site-subtitle"><span id="subtitle"></span></div><div id="site_social_icons"><a class="social-icon" href="https://github.com/baojieAngel/baojieAngel.github.io" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:[email protected]" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left"><a href="/2024/03/22/sql-server%E4%BA%8B%E5%8A%A1/" title="sql server事务"><img class="post_bg" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj2.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="sql server事务"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/03/22/sql-server%E4%BA%8B%E5%8A%A1/" title="sql server事务">sql server事务</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2024-03-22T07:05:47.000Z" title="发表于 2024-03-22 15:05:47">2024-03-22</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-03-22T07:33:51.433Z" title="更新于 2024-03-22 15:33:51">2024-03-22</time></span></div><div class="content">事务
定义一个事务的开始:begin tran
提交一个事务:commit tran
回滚事务:rollback tran
在事务内设置保存点:save tran [name]名字
事务的回滚
需求:想删除id为2000,2001,不删除2002的记录,需要进行回滚123456789begin transave tran adelete from teacher where tno=2000save tran bdelete from teacher where tno=2001save tran cdelete from teacher where tno=2002rollback tran c
</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2024/03/22/sql-server%E5%A4%87%E4%BB%BD%E8%BF%98%E5%8E%9F/" title="sql server备份还原"><img class="post_bg" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj2.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="sql server备份还原"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/03/22/sql-server%E5%A4%87%E4%BB%BD%E8%BF%98%E5%8E%9F/" title="sql server备份还原">sql server备份还原</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2024-03-22T07:05:47.000Z" title="发表于 2024-03-22 15:05:47">2024-03-22</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-03-22T07:42:41.766Z" title="更新于 2024-03-22 15:42:41">2024-03-22</time></span></div><div class="content">使用sql语句备份数据库123BACKUP DATABASE teaching --表名TO DISK ='F:\backup\teaching.bak' --路径名WITH FORMAT
使用sql语句还原数据库123RESTORE DATABASE teaching 表名FROM DISK='F:\backup\teaching.bak' --路径名
</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2024/03/22/sql-server%E8%A7%86%E5%9B%BE%E7%B4%A2%E5%BC%95/" title="视图和索引"><img class="post_bg" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj1.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="视图和索引"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/03/22/sql-server%E8%A7%86%E5%9B%BE%E7%B4%A2%E5%BC%95/" title="视图和索引">视图和索引</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2024-03-22T06:16:47.000Z" title="发表于 2024-03-22 14:16:47">2024-03-22</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-03-22T07:05:11.365Z" title="更新于 2024-03-22 15:05:11">2024-03-22</time></span></div><div class="content">视图
视图只能对单张表进行修改更新,不能对多表进行操作
创建视图1234gocreate view v_studentasselect * from student where sdept='电子商务'
使用视图1select * from v_student
索引
创建格式
1234 唯一索引 聚集索引 非聚集索引(默认)create [unique][clustered][nonclustered]index index_nameon {table_name |view_name |column[...n]}
删除索引
1drop index student.index_sname
删除主键索引
需要先删除主键约束(constraint)1alter table test drop constraint PK_test
同义词
创建别名
12create synonym sfor student
使用别名
1select * from s
删除同义词,不影响
1drop synonym s
</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2024/03/21/DML%E8%A7%A6%E5%8F%91%E5%99%A8/" title="DML触发器和DDL触发器"><img class="post_bg" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj3.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="DML触发器和DDL触发器"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/03/21/DML%E8%A7%A6%E5%8F%91%E5%99%A8/" title="DML触发器和DDL触发器">DML触发器和DDL触发器</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2024-03-21T03:02:52.065Z" title="发表于 2024-03-21 11:02:52">2024-03-21</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-03-22T06:15:40.965Z" title="更新于 2024-03-22 14:15:40">2024-03-22</time></span></div><div class="content">DML触发器
定义了两个特殊的表,一个是插入表:inserted,一个是删除表:deleted
当用户执行insert语句时,所有被添加的记录都会存储在inserted表以及触发器所在的表中
当用户执行delete语句时,从触发器所在的表中被删除的行会发送到deleted表中
而对于update语句,sql server先将要进行修改的记录行存储到deleted表中,然后再将修改后的数据行存储到inserted表以及触发器所在的表中
DML触发器
为教师表teacher 创建一个DML触发器,在插入和修改数据的时候,自动显示所有教师的信息
12345678gocreate trigger print_teacher --触发器名称 on teacher --哪张表for insert,update --在插入,更新后asbegin select * from teacher --触发内容end
触发语句insert into teacher values(‘’)update teacher set name=’信心’ where id=’1001’;
...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2024/03/20/sql-server%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B/" title="存储过程"><img class="post_bg" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj2.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="存储过程"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/03/20/sql-server%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B/" title="存储过程">存储过程</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2024-03-20T09:05:47.000Z" title="发表于 2024-03-20 17:05:47">2024-03-20</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-03-21T02:58:08.047Z" title="更新于 2024-03-21 10:58:08">2024-03-21</time></span></div><div class="content">存储无参过程
创建简单的存储过程
存储过程没有返回值 不带参数的存储过程后面没有()
123456gocreate proc usp_helloworldasbegin print 'hello world'end
执行存储规程
1exec usp_helloworld
创建带参数的存储过程12345create proc usp_student(@name varchar(20),@age int)asbegin select * from student where sname=@name and sage=@ageend
执行存储规程1exec usp_student '张三',20
创建带有输出参数的存储过程 out 关键字123456789create proc count_course( @cn varchar(10), @recordCount int out 代表输出参数)asbegin select * from sc where cno = @cn select @recordCoun ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2024/03/19/sql-server/" title="sql server管理"><img class="post_bg" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj3.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="sql server管理"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/03/19/sql-server/" title="sql server管理">sql server管理</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2024-03-19T03:44:47.000Z" title="发表于 2024-03-19 11:44:47">2024-03-19</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-03-20T09:06:58.661Z" title="更新于 2024-03-20 17:06:58">2024-03-20</time></span></div><div class="content">Sql Server数据库操作
master:基本配置
model:用建立数据库提供一个模型(可以设置初始化大小,后续建立就是指定) (创建文件默认为3MB,日志默认为512kb)
msdb:提供支持代理程序,产生一些监控信息
tempdb:临时的存储过程16450-16460
命令行创建数据库create database businesson primary( name=,//字段名字 filename=,//物理存储路径 size=,//初始大小 maxsize=,//最大大小 filegrwoth=10% //增幅)log on //事务日志文件(
)
定义变量name 字符类型, age 整型declare @name varchar(20), @age int
赋值
set @name=’张三’
set @age=’18’
select 赋值 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2024/01/04/Collection%E7%9A%84set/" title="set类"><img class="post_bg" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj2.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="set类"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/01/04/Collection%E7%9A%84set/" title="set类">set类</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2024-01-04T08:17:37.535Z" title="发表于 2024-01-04 16:17:37">2024-01-04</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-01-04T09:25:49.984Z" title="更新于 2024-01-04 17:25:49">2024-01-04</time></span></div><div class="content">Set:存储无序的、不可重复的数据—-子接口:Set:存储无序的、不可重复的数据 —- HashSet:主要实现类;底层使用的是HashMap,即使用数组+单向链表+红黑树结构进行存储(jdk8中) —- LinkedHashSet(HashSet的子类):在现有的数组+单向链表+红黑树结构的基础上,又添加了一组双向链表,用于记录添加元素的先后顺序,即可以按照添加元素的顺序实现遍历,便于频繁的查询操作。 —- TreeSet:底层使用红黑树存储,可以按照添加的元素的,指定的属性的大小顺序进行遍历。
set中的无序性无序性:
!= 随机性
添加元素的顺序和遍历元素的顺序不一致,是不是就是无序性?NO
无序性指的是与添加的元素的位置有关,不像ArrayList一样是依次紧密排列的
这里是根据添加的元素的哈希值,计算的其在数组中的存储位置,此位置不是依次排列的,表现为无序性
不可重复性
添加到Set中的元素是不能相同的,
比较的标准,需要判断hashCode()得到的哈希值与equals()得到的结果是否相同
哈希值相同且e ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2024/01/04/Collection%E7%9A%84list/" title="List类"><img class="post_bg" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj3.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="List类"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/01/04/Collection%E7%9A%84list/" title="List类">List类</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2024-01-04T07:38:39.424Z" title="发表于 2024-01-04 15:38:39">2024-01-04</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-01-04T08:20:40.379Z" title="更新于 2024-01-04 16:20:40">2024-01-04</time></span></div><div class="content">list:存储有序,可重复的数据(“动态数组”) 父类:Collection—–子接口:List:存储有序的、可重复的数据(“动态”数组) —- ArrayList:主要实现类 —- LinkedList、Vector
</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/12/26/StringBuffer%E5%92%8CStringBuilder/" title="StringBuffer和StringBuilder"><img class="post_bg" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj3.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="StringBuffer和StringBuilder"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/12/26/StringBuffer%E5%92%8CStringBuilder/" title="StringBuffer和StringBuilder">StringBuffer和StringBuilder</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-12-26T02:59:47.000Z" title="发表于 2023-12-26 10:59:47">2023-12-26</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-12-28T04:18:11.525Z" title="更新于 2023-12-28 12:18:11">2023-12-28</time></span></div><div class="content">三个类的对比:String、StringBuffer、StringBuilder
String:不可变字符序列,底层使用char,底层使用byte[],(jdk9及之后)
StringBuffer:可变字符序列;JDK1.0声明,线程安全的,效率低,底层使用char,底层使用byte[],(jdk9及之后)
StringBuilder:可变字符序列,JDK5.0声明,线程不安全的,效率高,底层使用char,底层使用byte[],(jdk9及之后)
StingBuffer和StringBuilder内部的属性有:
char[] value;//存储字符序列
int count;//实际存储的字符的个数
StringBuilder sb = new StringBuilder();//char[] value = new char[16];当new一个StringBuilder时,会自动开辟一个16大小的字符空间
如果字符大于原本的空间,超过value.length时,就需要扩容,默认扩容为原有容量的2 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/12/15/String%E7%B1%BB/" title="String类"><img class="post_bg" src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj2.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="String类"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/12/15/String%E7%B1%BB/" title="String类">String类</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-12-15T10:08:47.000Z" title="发表于 2023-12-15 18:08:47">2023-12-15</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-12-15T17:11:14.958Z" title="更新于 2023-12-16 01:11:14">2023-12-16</time></span></div><div class="content">String类的理解(以JDK8为例说明)1.1类的声明public final class String inplementsjava.io.Serializable,Comparable,CharSequence
final:String是不可被继承的
SerializabLe:可序列化的接口。凡是实现此接口的类的对象就可以通过网络或本地流进行数据的传输
ComparabLe:凡是实现此接口的类,其对象都可以比较大小。
内部声明的属性:private final char value[];//存储字符串数据的容器
final:指明此value数组一旦初始化,其地址就不可变。
字符串常量的存储位置
字符串常量都存储在字符串常量池(StringTable)中
字符串常量池不允许存放两个相同的字符串常量。
字符串常量池,在不同的dk版本中,存放位置不同。
jdk7之前:字符串常量池存放在方法区
jdk7及之后:字符串常量池存放在堆空间。
字符串的不可变性
当对字符串变量重新赋值时,需要重新指定一个字符串常量的位置进行赋值,不能在原有 ...</div></div></div><nav id="pagination"><div class="pagination"><span class="page-number current">1</span><a class="page-number" href="/page/2/#content-inner">2</a><span class="space">…</span><a class="page-number" href="/page/7/#content-inner">7</a><a class="extend next" rel="next" href="/page/2/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">John Jie</div><div class="author-info__description">HEXO JIE</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">66</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/baojieAngel/baojieAngel.github.io"><i class="fab fa-github"></i><span>A Simple and Card UI Design theme for Hexo</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/baojieAngel/baojieAngel.github.io" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:[email protected]" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2024/03/22/sql-server%E4%BA%8B%E5%8A%A1/" title="sql server事务"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj2.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="sql server事务"/></a><div class="content"><a class="title" href="/2024/03/22/sql-server%E4%BA%8B%E5%8A%A1/" title="sql server事务">sql server事务</a><time datetime="2024-03-22T07:05:47.000Z" title="发表于 2024-03-22 15:05:47">2024-03-22</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2024/03/22/sql-server%E5%A4%87%E4%BB%BD%E8%BF%98%E5%8E%9F/" title="sql server备份还原"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj2.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="sql server备份还原"/></a><div class="content"><a class="title" href="/2024/03/22/sql-server%E5%A4%87%E4%BB%BD%E8%BF%98%E5%8E%9F/" title="sql server备份还原">sql server备份还原</a><time datetime="2024-03-22T07:05:47.000Z" title="发表于 2024-03-22 15:05:47">2024-03-22</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2024/03/22/sql-server%E8%A7%86%E5%9B%BE%E7%B4%A2%E5%BC%95/" title="视图和索引"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj1.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="视图和索引"/></a><div class="content"><a class="title" href="/2024/03/22/sql-server%E8%A7%86%E5%9B%BE%E7%B4%A2%E5%BC%95/" title="视图和索引">视图和索引</a><time datetime="2024-03-22T06:16:47.000Z" title="发表于 2024-03-22 14:16:47">2024-03-22</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2024/03/21/DML%E8%A7%A6%E5%8F%91%E5%99%A8/" title="DML触发器和DDL触发器"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj3.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="DML触发器和DDL触发器"/></a><div class="content"><a class="title" href="/2024/03/21/DML%E8%A7%A6%E5%8F%91%E5%99%A8/" title="DML触发器和DDL触发器">DML触发器和DDL触发器</a><time datetime="2024-03-21T03:02:52.065Z" title="发表于 2024-03-21 11:02:52">2024-03-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2024/03/20/sql-server%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B/" title="存储过程"><img src= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-lazy-src="https://baojieAngel.github.io/img/bj2.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="存储过程"/></a><div class="content"><a class="title" href="/2024/03/20/sql-server%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B/" title="存储过程">存储过程</a><time datetime="2024-03-20T09:05:47.000Z" title="发表于 2024-03-20 17:05:47">2024-03-20</time></div></div></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/03/"><span class="card-archive-list-date">三月 2024</span><span class="card-archive-list-count">6</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/01/"><span class="card-archive-list-date">一月 2024</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/12/"><span class="card-archive-list-date">十二月 2023</span><span class="card-archive-list-count">11</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/11/"><span class="card-archive-list-date">十一月 2023</span><span class="card-archive-list-count">10</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/09/"><span class="card-archive-list-date">九月 2023</span><span class="card-archive-list-count">31</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/01/"><span class="card-archive-list-date">一月 2023</span><span class="card-archive-list-count">4</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/11/"><span class="card-archive-list-date">十一月 2022</span><span class="card-archive-list-count">2</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">66</div></div><div class="webinfo-item"><div class="item-name">本站总字数 :</div><div class="item-count">26.4k</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2024-03-22T07:48:11.574Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">©2022 - 2024 By John Jie</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span> 数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script>function panguFn () {
if (typeof pangu === 'object') pangu.autoSpacingPage()
else {
getScript('https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js')
.then(() => {
pangu.autoSpacingPage()
})
}
}
function panguInit () {
if (false){
GLOBAL_CONFIG_SITE.isPost && panguFn()
} else {
panguFn()
}
}
document.addEventListener('DOMContentLoaded', panguInit)</script><script src="/js/search/local-search.js"></script><div class="js-pjax"><script>function subtitleType () {
fetch('https://v1.hitokoto.cn')
.then(response => response.json())
.then(data => {
if (true) {
const from = '出自 ' + data.from
const sub = []
sub.unshift(data.hitokoto, from)
window.typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: true,
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = data.hitokoto
}
})
}
if (true) {
if (typeof Typed === 'function') {
subtitleType()
} else {
getScript('https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js').then(subtitleType)
}
} else {
subtitleType()
}
</script></div><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/fireworks.min.js"></script><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="50" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-nest.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>