------------------java collection 集合学习 ----小白学习笔记,,有错,请指出谢谢

<!doctype html>java对象集合学习记录

figure:first-child { margin-top: -20px; }
#write ol, #write ul { position: relative; }
img { max-width: 100%; vertical-align: middle; }
button, input, select, textarea { color: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; }
input[type="checkbox"], input[type="radio"] { line-height: normal; padding: 0px; }
*, ::after, ::before { box-sizing: border-box; }
#write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p, #write pre { width: inherit; }
#write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p { position: relative; }
h1, h2, h3, h4, h5, h6 { break-after: avoid-page; break-inside: avoid; orphans: 2; }
p { orphans: 4; }
h1 { font-size: 2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.6rem; }
h4 { font-size: 1.4rem; }
h5 { font-size: 1.2rem; }
h6 { font-size: 1rem; }
.md-math-block, .md-rawblock, h1, h2, h3, h4, h5, h6, p { margin-top: 1rem; margin-bottom: 1rem; }
.hidden { display: none; }
.md-blockmeta { color: rgb(204, 204, 204); font-weight: 700; font-style: italic; }
a { cursor: pointer; }
sup.md-footnote { padding: 2px 4px; background-color: rgba(238, 238, 238, 0.7); color: rgb(85, 85, 85); border-radius: 4px; cursor: pointer; }
sup.md-footnote a, sup.md-footnote a:hover { color: inherit; text-transform: inherit; text-decoration: inherit; }
#write input[type="checkbox"] { cursor: pointer; width: inherit; height: inherit; }
figure { overflow-x: auto; margin: 1.2em 0px; max-width: calc(100% + 16px); padding: 0px; }
figure > table { margin: 0px !important; }
tr { break-inside: avoid; break-after: auto; }
thead { display: table-header-group; }
table { border-collapse: collapse; border-spacing: 0px; width: 100%; overflow: auto; break-inside: auto; text-align: left; }
table.md-table td { min-width: 32px; }
.CodeMirror-gutters { border-right: 0px; background-color: inherit; }
.CodeMirror-linenumber { user-select: none; }
.CodeMirror { text-align: left; }
.CodeMirror-placeholder { opacity: 0.3; }
.CodeMirror pre { padding: 0px 4px; }
.CodeMirror-lines { padding: 0px; }
div.hr:focus { cursor: none; }
#write pre { white-space: pre-wrap; }
#write.fences-no-line-wrapping pre { white-space: pre; }
#write pre.ty-contain-cm { white-space: normal; }
.CodeMirror-gutters { margin-right: 4px; }
.md-fences { font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; overflow: visible; white-space: pre; background: inherit; position: relative !important; }
.md-diagram-panel { width: 100%; margin-top: 10px; text-align: center; padding-top: 0px; padding-bottom: 8px; overflow-x: auto; }
#write .md-fences.mock-cm { white-space: pre-wrap; }
.md-fences.md-fences-with-lineno { padding-left: 0px; }
#write.fences-no-line-wrapping .md-fences.mock-cm { white-space: pre; overflow-x: auto; }
.md-fences.mock-cm.md-fences-with-lineno { padding-left: 8px; }
.CodeMirror-line, twitterwidget { break-inside: avoid; }
.footnotes { opacity: 0.8; font-size: 0.9rem; margin-top: 1em; margin-bottom: 1em; }
.footnotes + .footnotes { margin-top: 0px; }
.md-reset { margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: top; background: 0px 0px; text-decoration: none; text-shadow: none; float: none; position: static; width: auto; height: auto; white-space: nowrap; cursor: inherit; -webkit-tap-highlight-color: transparent; line-height: normal; font-weight: 400; text-align: left; box-sizing: content-box; direction: ltr; }
li div { padding-top: 0px; }
blockquote { margin: 1rem 0px; }
li .mathjax-block, li p { margin: 0.5rem 0px; }
li { margin: 0px; position: relative; }
blockquote > :last-child { margin-bottom: 0px; }
blockquote > :first-child, li > :first-child { margin-top: 0px; }
.footnotes-area { color: rgb(136, 136, 136); margin-top: 0.714rem; padding-bottom: 0.143rem; white-space: normal; }
#write .footnote-line { white-space: pre-wrap; }
@media print {
body, html { border: 1px solid transparent; height: 99%; break-after: avoid; break-before: avoid; }
#write { margin-top: 0px; padding-top: 0px; border-color: transparent !important; }
.typora-export * { -webkit-print-color-adjust: exact; }
html.blink-to-pdf { font-size: 13px; }
.typora-export #write { padding-left: 32px; padding-right: 32px; padding-bottom: 0px; break-after: avoid; }
.typora-export #write::after { height: 0px; }
@page { margin: 20mm 0px; }
}
.footnote-line { margin-top: 0.714em; font-size: 0.7em; }
a img, img a { cursor: pointer; }
pre.md-meta-block { font-size: 0.8rem; min-height: 0.8rem; white-space: pre-wrap; background: rgb(204, 204, 204); display: block; overflow-x: hidden; }
p > .md-image:only-child:not(.md-img-error) img, p > img:only-child { display: block; margin: auto; }
p > .md-image:only-child { display: inline-block; width: 100%; }
#write .MathJax_Display { margin: 0.8em 0px 0px; }
.md-math-block { width: 100%; }
.md-math-block:not(:empty)::after { display: none; }
[contenteditable="true"]:active, [contenteditable="true"]:focus { outline: 0px; box-shadow: none; }
.md-task-list-item { position: relative; list-style-type: none; }
.task-list-item.md-task-list-item { padding-left: 0px; }
.md-task-list-item > input { position: absolute; top: 0px; left: 0px; margin-left: -1.2em; margin-top: calc(1em - 10px); border: none; }
.math { font-size: 1rem; }
.md-toc { min-height: 3.58rem; position: relative; font-size: 0.9rem; border-radius: 10px; }
.md-toc-content { position: relative; margin-left: 0px; }
.md-toc-content::after, .md-toc::after { display: none; }
.md-toc-item { display: block; color: rgb(65, 131, 196); }
.md-toc-item a { text-decoration: none; }
.md-toc-inner:hover { text-decoration: underline; }
.md-toc-inner { display: inline-block; cursor: pointer; }
.md-toc-h1 .md-toc-inner { margin-left: 0px; font-weight: 700; }
.md-toc-h2 .md-toc-inner { margin-left: 2em; }
.md-toc-h3 .md-toc-inner { margin-left: 4em; }
.md-toc-h4 .md-toc-inner { margin-left: 6em; }
.md-toc-h5 .md-toc-inner { margin-left: 8em; }
.md-toc-h6 .md-toc-inner { margin-left: 10em; }
@media screen and (max-width: 48em) {
.md-toc-h3 .md-toc-inner { margin-left: 3.5em; }
.md-toc-h4 .md-toc-inner { margin-left: 5em; }
.md-toc-h5 .md-toc-inner { margin-left: 6.5em; }
.md-toc-h6 .md-toc-inner { margin-left: 8em; }
}
a.md-toc-inner { font-size: inherit; font-style: inherit; font-weight: inherit; line-height: inherit; }
.footnote-line a:not(.reversefootnote) { color: inherit; }
.md-attr { display: none; }
.md-fn-count::after { content: "."; }
code, pre, samp, tt { font-family: var(--monospace); }
kbd { margin: 0px 0.1em; padding: 0.1em 0.6em; font-size: 0.8em; color: rgb(36, 39, 41); background: rgb(255, 255, 255); border: 1px solid rgb(173, 179, 185); border-radius: 3px; box-shadow: rgba(12, 13, 14, 0.2) 0px 1px 0px, rgb(255, 255, 255) 0px 0px 0px 2px inset; white-space: nowrap; vertical-align: middle; }
.md-comment { color: rgb(162, 127, 3); opacity: 0.8; font-family: var(--monospace); }
code { text-align: left; vertical-align: initial; }
a.md-print-anchor { white-space: pre !important; border-width: initial !important; border-style: none !important; border-color: initial !important; display: inline-block !important; position: absolute !important; width: 1px !important; right: 0px !important; outline: 0px !important; background: 0px 0px !important; text-decoration: initial !important; text-shadow: initial !important; }
.md-inline-math .MathJax_SVG .noError { display: none !important; }
.html-for-mac .inline-math-svg .MathJax_SVG { vertical-align: 0.2px; }
.md-math-block .MathJax_SVG_Display { text-align: center; margin: 0px; position: relative; text-indent: 0px; max-width: none; max-height: none; min-height: 0px; min-width: 100%; width: auto; overflow-y: hidden; display: block !important; }
.MathJax_SVG_Display, .md-inline-math .MathJax_SVG_Display { width: auto; margin: inherit; display: inline-block !important; }
.MathJax_SVG .MJX-monospace { font-family: var(--monospace); }
.MathJax_SVG .MJX-sans-serif { font-family: sans-serif; }
.MathJax_SVG { display: inline; font-style: normal; font-weight: 400; line-height: normal; zoom: 90%; text-indent: 0px; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin: 0px; }
.MathJax_SVG * { transition: none; }
.MathJax_SVG_Display svg { vertical-align: middle !important; margin-bottom: 0px !important; }
.os-windows.monocolor-emoji .md-emoji { font-family: "Segoe UI Symbol", sans-serif; }
.md-diagram-panel > svg { max-width: 100%; }
[lang="mermaid"] svg, [lang="flow"] svg { max-width: 100%; }
[lang="mermaid"] .node text { font-size: 1rem; }
table tr th { border-bottom: 0px; }
video { max-width: 100%; display: block; margin: 0px auto; }
iframe { max-width: 100%; width: 100%; border: none; }
.highlight td, .highlight tr { border: 0px; }

.CodeMirror { height: auto; }
.CodeMirror.cm-s-inner { background: inherit; }
.CodeMirror-scroll { overflow-y: hidden; overflow-x: auto; z-index: 3; }
.CodeMirror-gutter-filler, .CodeMirror-scrollbar-filler { background-color: rgb(255, 255, 255); }
.CodeMirror-gutters { border-right: 1px solid rgb(221, 221, 221); background: inherit; white-space: nowrap; }
.CodeMirror-linenumber { padding: 0px 3px 0px 5px; text-align: right; color: rgb(153, 153, 153); }
.cm-s-inner .cm-keyword { color: rgb(119, 0, 136); }
.cm-s-inner .cm-atom, .cm-s-inner.cm-atom { color: rgb(34, 17, 153); }
.cm-s-inner .cm-number { color: rgb(17, 102, 68); }
.cm-s-inner .cm-def { color: rgb(0, 0, 255); }
.cm-s-inner .cm-variable { color: rgb(0, 0, 0); }
.cm-s-inner .cm-variable-2 { color: rgb(0, 85, 170); }
.cm-s-inner .cm-variable-3 { color: rgb(0, 136, 85); }
.cm-s-inner .cm-string { color: rgb(170, 17, 17); }
.cm-s-inner .cm-property { color: rgb(0, 0, 0); }
.cm-s-inner .cm-operator { color: rgb(152, 26, 26); }
.cm-s-inner .cm-comment, .cm-s-inner.cm-comment { color: rgb(170, 85, 0); }
.cm-s-inner .cm-string-2 { color: rgb(255, 85, 0); }
.cm-s-inner .cm-meta { color: rgb(85, 85, 85); }
.cm-s-inner .cm-qualifier { color: rgb(85, 85, 85); }
.cm-s-inner .cm-builtin { color: rgb(51, 0, 170); }
.cm-s-inner .cm-bracket { color: rgb(153, 153, 119); }
.cm-s-inner .cm-tag { color: rgb(17, 119, 0); }
.cm-s-inner .cm-attribute { color: rgb(0, 0, 204); }
.cm-s-inner .cm-header, .cm-s-inner.cm-header { color: rgb(0, 0, 255); }
.cm-s-inner .cm-quote, .cm-s-inner.cm-quote { color: rgb(0, 153, 0); }
.cm-s-inner .cm-hr, .cm-s-inner.cm-hr { color: rgb(153, 153, 153); }
.cm-s-inner .cm-link, .cm-s-inner.cm-link { color: rgb(0, 0, 204); }
.cm-negative { color: rgb(221, 68, 68); }
.cm-positive { color: rgb(34, 153, 34); }
.cm-header, .cm-strong { font-weight: 700; }
.cm-del { text-decoration: line-through; }
.cm-em { font-style: italic; }
.cm-link { text-decoration: underline; }
.cm-error { color: red; }
.cm-invalidchar { color: red; }
.cm-constant { color: rgb(38, 139, 210); }
.cm-defined { color: rgb(181, 137, 0); }
div.CodeMirror span.CodeMirror-matchingbracket { color: rgb(0, 255, 0); }
div.CodeMirror span.CodeMirror-nonmatchingbracket { color: rgb(255, 34, 34); }
.cm-s-inner .CodeMirror-activeline-background { background: inherit; }
.CodeMirror { position: relative; overflow: hidden; }
.CodeMirror-scroll { height: 100%; outline: 0px; position: relative; box-sizing: content-box; background: inherit; }
.CodeMirror-sizer { position: relative; }
.CodeMirror-gutter-filler, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-vscrollbar { position: absolute; z-index: 6; display: none; }
.CodeMirror-vscrollbar { right: 0px; top: 0px; overflow: hidden; }
.CodeMirror-hscrollbar { bottom: 0px; left: 0px; overflow: hidden; }
.CodeMirror-scrollbar-filler { right: 0px; bottom: 0px; }
.CodeMirror-gutter-filler { left: 0px; bottom: 0px; }
.CodeMirror-gutters { position: absolute; left: 0px; top: 0px; padding-bottom: 30px; z-index: 3; }
.CodeMirror-gutter { white-space: normal; height: 100%; box-sizing: content-box; padding-bottom: 30px; margin-bottom: -32px; display: inline-block; }
.CodeMirror-gutter-wrapper { position: absolute; z-index: 4; background: 0px 0px !important; border: none !important; }
.CodeMirror-gutter-background { position: absolute; top: 0px; bottom: 0px; z-index: 4; }
.CodeMirror-gutter-elt { position: absolute; cursor: default; z-index: 4; }
.CodeMirror-lines { cursor: text; }
.CodeMirror pre { border-radius: 0px; border-width: 0px; background: 0px 0px; font-family: inherit; font-size: inherit; margin: 0px; white-space: pre; word-wrap: normal; color: inherit; z-index: 2; position: relative; overflow: visible; }
.CodeMirror-wrap pre { word-wrap: break-word; white-space: pre-wrap; word-break: normal; }
.CodeMirror-code pre { border-right: 30px solid transparent; width: fit-content; }
.CodeMirror-wrap .CodeMirror-code pre { border-right: none; width: auto; }
.CodeMirror-linebackground { position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; z-index: 0; }
.CodeMirror-linewidget { position: relative; z-index: 2; overflow: auto; }
.CodeMirror-wrap .CodeMirror-scroll { overflow-x: hidden; }
.CodeMirror-measure { position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden; }
.CodeMirror-measure pre { position: static; }
.CodeMirror div.CodeMirror-cursor { position: absolute; visibility: hidden; border-right: none; width: 0px; }
.CodeMirror div.CodeMirror-cursor { visibility: hidden; }
.CodeMirror-focused div.CodeMirror-cursor { visibility: inherit; }
.cm-searching { background: rgba(255, 255, 0, 0.4); }
@media print {
.CodeMirror div.CodeMirror-cursor { visibility: hidden; }
}

.cm-s-inner .cm-variable { color: rgb(255, 255, 255); }
.cm-s-inner .cm-keyword, .cm-s-inner .cm-property { color: rgb(102, 153, 204); }
.cm-s-inner .cm-tag { color: rgb(236, 95, 103); }
.CodeMirror div.CodeMirror-cursor { border-left: 1px solid rgb(184, 191, 198); z-index: 3; }
.cm-s-inner .cm-string { color: rgb(153, 199, 148); }
.cm-s-inner .cm-comment, .cm-s-inner.cm-comment { color: rgb(101, 115, 126); }
.cm-s-inner .cm-header, .cm-s-inner .cm-def, .cm-s-inner.cm-header, .cm-s-inner.cm-def, .cm-s-inner .cm-attribute, .cm-s-inner .cm-operator { color: rgb(197, 148, 197); }
.cm-s-inner .cm-quote, .cm-s-inner.cm-quote { color: rgb(153, 199, 148); }
.cm-s-inner .cm-hr { color: rgb(216, 213, 213); }
.cm-s-inner .cm-link { color: rgb(211, 211, 239); }
.cm-s-inner .cm-negative { color: rgb(236, 95, 103); }
.cm-s-inner .cm-positive { color: rgb(153, 199, 148); }
.cm-s-inner .cm-string-2 { color: rgb(236, 95, 103); }
.cm-s-inner .cm-meta, .cm-s-inner .cm-qualifier { color: rgb(183, 179, 179); }
.cm-s-inner .cm-builtin { color: rgb(243, 179, 248); }
.cm-s-inner .cm-bracket { color: rgb(95, 179, 179); }
.cm-s-inner .cm-atom, .cm-s-inner.cm-atom { color: rgb(132, 182, 203); }
.cm-s-inner .cm-number { color: rgb(249, 145, 87); }
.cm-s-inner .cm-variable { color: rgb(184, 191, 198); }
.cm-s-inner .cm-variable-2 { color: rgb(159, 186, 213); }
.cm-s-inner .cm-variable-3 { color: rgb(28, 198, 133); }
.CodeMirror-selectedtext, .CodeMirror-selected { background: rgb(74, 137, 220); text-shadow: none; color: rgb(255, 255, 255) !important; }
.CodeMirror-gutters { border-right: none; }

:root { --accent-color: #aeb1b5; --dark-accent-color: #787a7c; --background-color: white; --border-color: #ddd; --code-bg-color: #f8f8f8; --font-color: #42464c; --header-color: #222324; --link-color: #2077b2; --control-text-color: #667176; --side-bar-bg-color: #fafafa; --body-font: "Iosevka", "Fira Mono", "Source Code Pro", Courier, monospace; --header-font: "Fira Sans", "Roboto", "Source Sans Pro", sans-serif; --border-radius: 2px; --document-horizontal-margin: 80px; --document-padding-x: 10ch; --font-size: 16px; --h1-fontsize: 2rem; --h2-fontsize: 1.375rem; --h3-fontsize: 1.25rem; --h4-fontsize: 1.125rem; --line-height: 1.4; --main-content-margin: 0 auto; --main-content-max-width: 100ch; --monospace-font-size: 15px; --monospace-font: "Iosevka", "Fira Mono", "Source Code Pro", Courier, monospace; --monospace-line-height: 1.4; --monospace: var(--monospace-font); --nav-width: 200px; --vertical-padding: 40px; }
@media (max-width: 640px) {
:root { --document-padding-x: 4ch; }
}
html { font-size: var(--font-size); background-color: var(--background-color); }
html, body { color: var(--font-color); font-family: var(--body-font); line-height: var(--line-height); }
#write { padding-left: var(--document-padding-x); padding-right: var(--document-padding-x); max-width: var(--main-content-max-width); box-sizing: border-box; }
pre.md-meta-block { background-color: var(--background-color); padding-bottom: 0.5rem; color: var(--accent-color); border-bottom: 2px solid var(--border-color); font-family: var(--monospace-font); }
h1, h2, h3, h4, h5, h6 { font-family: var(--header-font); font-weight: bold; color: var(--header-color); }
h1 { margin-top: 3rem; margin-bottom: 1.5rem; font-size: var(--h1-fontsize); }
h1:not(:first-child) { margin-top: 3rem; }
h2 { margin-top: 1.5rem; margin-bottom: 1.5rem; font-size: var(--h2-fontsize); }
h3 { margin-top: 1.5rem; margin-bottom: 1rem; font-size: var(--h3-fontsize); }
h4, h5, h6 { color: var(--header-color); margin-top: 1rem; margin-bottom: 0rem; font-size: 1rem; }
h4 { font-size: var(--h4-fontsize); }
h6 { color: var(--control-text-color); }
h1 tt, h1 code { font-size: inherit; }
h2 tt, h2 code { font-size: inherit; }
h3 tt, h3 code { font-size: inherit; }
h4 tt, h4 code { font-size: inherit; }
h5 tt, h5 code { font-size: inherit; }
h6 tt, h6 code { font-size: inherit; }
table { margin-top: 1rem; margin-bottom: 1rem; }
table tr:nth-child(2n), thead { background-color: var(--side-bar-bg-color); }
td, th { border-style: solid; border-color: var(--border-color); border-width: 1px; padding: 0.35rem 0.7rem; }
li p { margin: 0px; }
.task-list { padding-left: 0px; }
.task-list-item { padding-left: 1.5em; margin-bottom: 0rem; }
#write input[type="checkbox"] { margin-top: 5px; }
blockquote { margin: 1rem 0px 1rem 0.5ch; padding-left: 2ch; position: relative; overflow: hidden; border-left: 2px solid var(--border-color); color: var(--accent-color); }
hr { border-top: none; border-right: none; border-left: none; border-image: initial; border-bottom: 2px solid var(--border-color); margin-top: 1.4rem; margin-bottom: 1.4rem; }
p { margin: 1rem 0px; }
.cm-s-inner .CodeMirror-gutters { background: var(--code-bg-color); }
.code-tooltip { box-shadow: none; border-radius: var(--border-radius); background-color: var(--code-bg-color); border-color: var(--border-color); border-style: solid; border-width: 1px; }
.code-tooltip input { outline: none; width: 20ch; }
.md-fences .code-tooltip { bottom: -1.8rem; }
.md-fences.md-focus .cm-s-inner { border-bottom-right-radius: 0px; }
.autoComplt-hint { background-color: transparent !important; margin: 0px !important; padding: 0.125rem 0.375rem !important; color: var(--text-color) !important; line-height: var(--line-height) !important; height: 1.4rem !important; }
.autoComplt-hint-selected { background-color: var(--link-color) !important; color: var(--background-color) !important; }
.md-fences, code, tt { border: 1px solid var(--border-color); background-color: var(--code-bg-color); font-family: var(--monospace-font); font-size: var(--monospace-font-size); border-radius: 0.25rem; padding: 0px 0.125rem; line-height: var(--monospace-line-height); }
.md-fences { margin-bottom: 18px; margin-top: 15px; padding: 8px 1em 6px; }
a { color: var(--link-color); text-decoration: none; }
.outline-item:hover { color: var(--header-color); }
#write div.md-toc-tooltip { background-color: var(--background-color); }

:root { --accented-background-color: #464B5D; --light-header-color: #a5a7bd; --select-text-bg-color: #295080; --accent-color: rgb(120, 124, 136); --dark-accent-color: #464B5D; --background-color: #0F111A; --font-color: #8F93A2; --header-color: #EEFFFF; --border-color: #232629; --link-color: #6699CC; --code-bg-color: #0C1420; --hover-bg-color: #050505; --control-text-color: var(--font-color); --side-bar-bg-color: var(--background-color); --control-text-hover-color: var(--header-color); --item-hover-text-color: var(--header-color); --item-hover-bg-color: var(--hover-bg-color); --bg-color: var(--background-color); --text-color: var(--font-color); --meta-content-color: var(--accent-color); --md-char-color: var(--accent-color); --window-border: 0px solid rgba(0,0,0,0); --active-file-bg-color: var(--hover-bg-color); --rawblock-edit-panel-bd: var(--code-background-color); }
.outline-item:hover { background-color: var(--hover-bg-color); }
h1, h2, h3, h4, h5, h6 { color: var(--light-header-color); }
mark { background: rgb(184, 184, 10); }
table tr:nth-child(2n), thead { background-color: rgb(20, 19, 19); }
sup.md-footnote { background-color: var(--code-bg-color); color: var(--font-color); }
.md-before, .md-after { color: var(--dark-accent-color); }
table tr:nth-child(2n), thead { background-color: rgb(24, 28, 45); }
.md-url { color: rgb(197, 148, 197); }
footer.ty-footer { border-top: none; }
.typora-sourceview-on #toggle-sourceview-btn { background-color: var(--background-color); }
.cm-s-typora-default .CodeMirror-activeline-background { background-color: rgb(24, 28, 45); }
code, .md-fences { background: rgb(15, 17, 26); padding: 0.1em; font-size: 0.9em; margin-left: 0.2em; margin-right: 0.2em; }
.md-image > .md-meta { color: var(--accent-color); }
.context-menu { background-color: rgb(20, 19, 19); }
.context-menu.dropdown-menu .divider { background-color: rgb(35, 38, 41); }
.on-focus-mode .md-end-block:not(.md-focus):not(.md-focus-container) * { color: rgb(79, 82, 90) !important; }
.on-focus-mode .md-end-block:not(.md-focus) img, .on-focus-mode .md-task-list-item:not(.md-focus-container) > input { }
.on-focus-mode li[cid]:not(.md-focus-container) { color: rgb(79, 82, 90); }
.on-focus-mode .md-fences.md-focus .CodeMirror-code > :not(.CodeMirror-activeline) *, .on-focus-mode .CodeMirror.cm-s-inner:not(.CodeMirror-focused) * { color: rgb(79, 82, 90) !important; }
.on-focus-mode .md-focus, .on-focus-mode .md-focus-container { color: var(--light-header-color); }
.on-focus-mode #typora-source .CodeMirror-code > :not(.CodeMirror-activeline) * { color: rgb(79, 82, 90) !important; }

.typora-export li, .typora-export p, .typora-export, .footnote-line {white-space: normal;}
-->

java collection 集合学习

------------------java collection 集合学习 ----小白学习笔记,,有错,请指出谢谢

collection


collection 是一个接口,所以不能够实例化,只能通过其子类

 
 
 
xxxxxxxxxx
 
 
 
 
创建Collection对象的方法:
1.Collection c = new ArrayList();此时,c即为一个Collection 实例化的一个对象
 
 

Arraylist

 
 
 
xxxxxxxxxx
 
 
 
 
1.添加对象成员:集合对象.add(需添加的对象);(add方法永远都会成功,只返回true)
2.清除所有对象:集合对象.clear();
3.清楚单个对象:集合对象.remove(指定的对象);将指定的对象清除掉
4.判断集合是否含有元素:集合对象.inEmpty();返回true、false
5.判断集合中含有对象个数:集合对象.size();返回集合中含有对象的个数
6.将一个a集合添加到另一个b集合当中:b.addAll(a);(允许重复对象的存在)
7.移除集合a中含有结合b内的所有元素:a.removeAll(b);(只要移除b内一个元素就返回true)
8.判断集合a中是否含有b的全部对象:a.containsAll(b);当含全部才返回true
9.求两个集合内对象的交集:retainAll()
    eg: 前提集合a,集合b
    a.retainAll(b)
        交际赋值给Aa,  返回值  表示,集合a内的成员是否发生了变化
        如果  a内成员含有  a ,b,c
        b内成员含有 a,b,c,d
        a.retainAll(b)  则a成员不会发生变化,返回值为false因为a内成员没有发生变化
10.将结合转换成数组形式:toArray(); 返回Object[]数组
eg: Object [] objes = a.toArray();(这个过程其实就是一个向上继承的过程)
如果想用对象本身的方法的话需要向下还原成其特定的类型
如String s = (String ) objes[x];
11.逐带(遍历):a.iterator();   返回类型:Iterator(返回一个新的对象)
Iterator :  1.下一个对像:next();
2.判断下一个对象是否为空:hasNext();
3.

 
 

List(特点,有序(可以定位访问)且可重复)

1.由于是collection的子类,所以具有collection接口拥有的所以方法

 
 
 
xxxxxxxxxx
 
 
 
 
1.返回第一次出现的指定的对象:  indexOf(对象名)
2.返回最后一次出现的指定的对象:  indexOf(对象名)
3.根据下标删除指定对象:  a.remove(下标)   返回被删除的对象
4.获得指定下标的对象:  a.get(下标)
5.将指定位置的对象更换: a.set(下标,新对象)
6.在指定位置添加对象:  a.add(下标,对象)    会将后续的元素向后平移
(下标不能超过所容器的长度+1,既 最多可以在容器最后添加)
7.列表迭代器(特殊的是可以访问上一个对象元素) :a.listIterator();  返回一个ListIterator的对象实例
eg:ListIterator lit = new a.listIterator();
lit.previous()  这个是其特有的功能,作用是访问上一个对象元素
hasPrevious() 判断是否存在对象元素
previous (一般没有实际用,因为指针默认指向首位)
 
 
上一篇:CentOS 6.4安装pip,CentOS安装python包管理安装工具pip的方法


下一篇:Phonegap 通信原理