{"id":191,"date":"2024-08-13T10:39:08","date_gmt":"2024-08-13T01:39:08","guid":{"rendered":"https:\/\/techfun.cc\/?p=191"},"modified":"2025-06-02T12:51:24","modified_gmt":"2025-06-02T03:51:24","slug":"java_base_collection","status":"publish","type":"post","link":"https:\/\/techfun.cc\/java-base\/java_base_collection.html","title":{"rendered":"\u30b3\u30ec\u30af\u30b7\u30e7\u30f3"},"content":{"rendered":"<h3 class=\"Heading Title Title--m\" id=\"Bookmark-1\"><span class=\"Num\">1.<\/span>\u672c\u7ae0\u3067\u306e\u5b66\u7fd2\u9805\u76ee<\/h3>\n<p>\u672c\u7ae0\u3067\u306f\u3001\u8907\u6570\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u307e\u3068\u3081\u3066\u4fdd\u6301\u3059\u308b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u95a2\u3057\u3066\u5b66\u7fd2\u3057\u307e\u3059\u3002<\/p>\n<div class=\"Separator\">\n<div class=\"Separator__child\"><\/div>\n<\/div>\n<h3 class=\"Heading Title Title--m\" id=\"Bookmark-2\"><span class=\"Num\">2.<\/span>\u672c\u7ae0\u306e\u8b1b\u7fa9<\/h3>\n<p>\u672c\u7ae0\u3067\u5b66\u7fd2\u3059\u308b\u5185\u5bb9\u3092\u52d5\u753b\u3068\u3057\u3066\u307e\u3068\u3081\u305f\u3082\u306e\u3067\u3059\u3002\u6700\u521d\u306b\u4e00\u901a\u308a\u898b\u7d42\u308f\u3063\u305f\u5f8c\u3067\u3001\u5b66\u7fd2\u306b\u5165\u308b\u3088\u3046\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div class=\"Video-block\">\n<div class=\"Video-block__title\">\u8b1b\u7fa9:\u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/div>\n<div class=\"Video-block__video Youtube\">\n\t\t<iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube-nocookie.com\/embed\/_rSmQY96nVU?si=l_73HfZfSNFrqoHA&#038;rel=0\"\n\t\t\ttitle=\"YouTube video player\" frameborder=\"0\"\n\t\t\tallow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\"\n\t\t\treferrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p><\/div>\n<\/div>\n<div class=\"Separator\">\n<div class=\"Separator__child\"><\/div>\n<\/div>\n<h3 class=\"Heading Title Title--m\" id=\"Bookmark-3\"><span class=\"Num\">3.<\/span>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u6982\u8981<\/h3>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u306f\u3001\u8907\u6570\u306e\u30c7\u30fc\u30bf\u3092\u307e\u3068\u3081\u3066\u6271\u3044\u305f\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u307e\u3067\u306b\u300c\u914d\u5217\u300d\u306f\u5b66\u7fd2\u3057\u307e\u3057\u305f\u304c\u3001\u3053\u308c\u304b\u3089\u5b66\u7fd2\u3059\u308b\u300c\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u300d\u3082\u540c\u69d8\u306b\u8907\u6570\u306e\u30c7\u30fc\u30bf\u3092\u4fdd\u6301\u3059\u308b\u305f\u3081\u306e\u6a5f\u80fd\u3067\u3059\u3002<\/p>\n<p>Java\u3067\u306f\u3001\u300c\u914d\u5217\u300d\u3088\u308a\u3082\u300c\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u300d\u3092\u4f7f\u3046\u6a5f\u4f1a\u304c\u591a\u3044\u3067\u3059\u3002<br \/>\n\u300c\u914d\u5217\u300d\u306f\u4e00\u5ea6\u751f\u6210\u3059\u308b\u3068\u4fdd\u6301\u3067\u304d\u308b\u8981\u7d20\u306e\u6570\u304c\u6c7a\u307e\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u51e6\u7406\u306b\u3088\u3063\u3066\u306f\u3001\u4fdd\u6301\u3057\u305f\u3044\u8981\u7d20\u306e\u6570\u304c\u672a\u78ba\u5b9a\u306e\u3053\u3068\u3082\u3042\u308a\u3001\u3053\u306e\u3088\u3046\u306a\u3068\u304d\u306b\u306f\u3001\u300c\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u300d\u3092\u4f7f\u3046\u3068\u4fbf\u5229\u3067\u3059\u3002<br \/>\n\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306f\u3001\u914d\u5217\u3068\u7570\u306a\u308a\u3001\u8981\u7d20\u306e\u6570\u304c\u53ef\u5909\u3067\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u5165\u308c\u305f\u3044\u30c7\u30fc\u30bf\u3092\u5165\u308c\u305f\u3044\u3060\u3051\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u305f\u3060\u3057\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u4fdd\u6301\u3067\u304d\u308b\u30c7\u30fc\u30bf\u306f\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u307f\u3067\u3059\u3002\u57fa\u672c\u30c7\u30fc\u30bf\u578b\u3067\u3042\u308bint\u578b\u306e\u6570\u5024\uff08\u4f8b\u3048\u3070\u300110\uff09\u3092\u305d\u306e\u307e\u307e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u683c\u7d0d\u3067\u304d\u307e\u305b\u3093\u3002<br \/>\nint\u578b\u306e\u6570\u5024\u3092String\u3084Integer\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u5909\u63db\u3057\u3066\u304b\u3089\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u6ce8\u610f\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\u306a\u304a\u3001JDK5\u304b\u3089\u306f\u3001\u5f8c\u8ff0\u3059\u308b\u30aa\u30fc\u30c8\u30dc\u30af\u30b7\u30f3\u30b0\u6a5f\u80fd\u304c\u8ffd\u52a0\u3055\u308c\u305f\u305f\u3081\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u5909\u63db\u3092\u81ea\u52d5\u3067\u884c\u3063\u3066\u304f\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-3-1\"><span class=\"Num\">3.1.<\/span>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3API\u306e\u69cb\u6210<\/h4>\n<p>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u306f6\u3064\u306e\u4e3b\u8981\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u304c\u3042\u308a\u3001\u3053\u308c\u3089\u3092\u300c\u30b3\u30a2\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u300d\u3068\u547c\u3073\u307e\u3059\u3002<br \/>\n\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u95a2\u9023\u3059\u308bAPI\u306f\u3001\u300cjava.util\u300d\u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u5c5e\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u4f7f\u7528\u3059\u308b\u5834\u5408\u306b\u306f\u3001import\u6587\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u304c\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u30b3\u30a2\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3067\u3059\u3002<\/p>\n<table class=\"Base-table\">\n<colgroup>\n<col>\n<col>\n\t<\/colgroup>\n<thead>\n<tr>\n<th>\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9<\/th>\n<th>\u6982\u8981<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\n\t\t\t\tCollection\n\t\t\t<\/td>\n<td>\n\t\t\t\t\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u8868\u73fe\u3059\u308b\u6700\u3082\u57fa\u672c\u7684\u306a\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3067\u3059\u3002<br \/>\n\t\t\t\t\u8981\u7d20\u306e\u767b\u9332\u3001\u524a\u9664\u3001\u8981\u7d20\u6570\u3084\u5b58\u5728\u306e\u554f\u3044\u5408\u308f\u305b\u3001\u30a4\u30c6\u30ec\u30fc\u30bf\u306e\u751f\u6210\u3092\u884c\u3046\u30e1\u30bd\u30c3\u30c9\u304c\u57fa\u672c\u3068\u306a\u308a\u307e\u3059\u3002\n\t\t\t<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tList\n\t\t\t<\/td>\n<td>\n\t\t\t\t\u8981\u7d20\u304c\u9806\u5e8f\u3065\u3051\u3089\u308c\u305f\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3067\u3059\u3002<br \/>\n\t\t\t\t\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u7528\u3057\u3066\u8981\u7d20\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3068\u306a\u308a\u307e\u3059\u3002\n\t\t\t<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tSet\n\t\t\t<\/td>\n<td>\n\t\t\t\t\u91cd\u8907\u3092\u8a31\u3055\u306a\u3044\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3067\u3059\u3002<br \/>\n\t\t\t\t\u91cd\u8907\u3092\u8a31\u5bb9\u3057\u306a\u3044\u4ee5\u5916\u306fList\u306b\u4f3c\u3066\u3044\u307e\u3059\u3002\n\t\t\t<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tSortedSet\n\t\t\t<\/td>\n<td>\n\t\t\t\tSet\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u7d99\u627f\u3057\u3001\u8981\u7d20\u306e\u9806\u756a\u3092\u5185\u90e8\u3067\u4fdd\u6301\u3059\u308b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3067\u3059\u3002<br \/>\n\t\t\t\t\u8981\u7d20\u306e\u9806\u756a\u306f\u30ad\u30fc\u306e\u5927\u5c0f\u95a2\u4fc2\u3067\u6c7a\u307e\u308a\u307e\u3059\u3002<br \/>\n\t\t\t\tComparable\/Comparator\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306b\u3088\u3063\u3066\u30ad\u30fc\u306e\u5927\u5c0f\u95a2\u4fc2\u304c\u898f\u5b9a\u3055\u308c\u307e\u3059\u3002\n\t\t\t<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tMap\n\t\t\t<\/td>\n<td>\n\t\t\t\t\u300c\u30ad\u30fc\uff08key\uff09\u300d\u3068\u300c\u5024\uff08value\uff09\u300d\u30921\u7d44\u3068\u3057\u3066\u30c7\u30fc\u30bf\u3092\u4fdd\u6301\u3059\u308b\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3067\u3059\u3002<br \/>\n\t\t\t\t\u30ad\u30fc\u306e\u6307\u5b9a\u306b\u3088\u308b\u5024\u306e\u53d6\u308a\u51fa\u3057\u3084\u524a\u9664\u306a\u3069\u3092\u3059\u3070\u3084\u304f\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\n\t\t\t<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tSortedMap\n\t\t\t<\/td>\n<td>\n\t\t\t\tMap\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u7d99\u627f\u3057\u3001\u8981\u7d20\u306e\u9806\u756a\u3092\u5185\u90e8\u3067\u4fdd\u6301\u3059\u308b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3067\u3059\u3002<br \/>\n\t\t\t\t\u8981\u7d20\u306e\u9806\u756a\u306f\u30ad\u30fc\u306e\u5927\u5c0f\u95a2\u4fc2\u3067\u6c7a\u307e\u308a\u307e\u3059\u3002<br \/>\n\t\t\t\tComparable\/Comparator\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306b\u3088\u3063\u3066\u30ad\u30fc\u306e\u5927\u5c0f\u95a2\u4fc2\u304c\u898f\u5b9a\u3055\u308c\u307e\u3059\u3002\n\t\t\t<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u305d\u306e\u4ed6\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u4fbf\u5229\u306b\u5229\u7528\u3059\u308b\u305f\u3081\u306e\u30af\u30e9\u30b9\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<table class=\"Base-table\">\n<colgroup>\n<col>\n<col>\n\t<\/colgroup>\n<thead>\n<tr>\n<th>\u30af\u30e9\u30b9<\/th>\n<th>\u6982\u8981<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\n\t\t\t\tCollections\n\t\t\t<\/td>\n<td>\n\t\t\t\t\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u8fd4\u3059\u5404\u7a2e\u30e1\u30bd\u30c3\u30c9\u7fa4\n\t\t\t<\/td>\n<\/tr>\n<tr>\n<td>\n\t\t\t\tArrays\n\t\t\t<\/td>\n<td>\n\t\t\t\t\u30bd\u30fc\u30c8\u3084\u691c\u7d22\u7b49\u306e\u4fbf\u5229\u306a\u30e1\u30bd\u30c3\u30c9\u7fa4\n\t\t\t<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u6982\u8981\u8aac\u660e\u306f\u4ee5\u4e0a\u3067\u3059\u3002\u305d\u308c\u3067\u306f\u3001\u4ee3\u8868\u7684\u306a\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u6a5f\u80fd\u3092\u4e00\u3064\u4e00\u3064\u5b66\u7fd2\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<div class=\"Separator\">\n<div class=\"Separator__child\"><\/div>\n<\/div>\n<h3 class=\"Heading Title Title--m\" id=\"Bookmark-4\"><span class=\"Num\">4.<\/span>java.util.List\uff08\u30ea\u30b9\u30c8\uff09<\/h3>\n<p>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306f\u3001\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u4e2d\u5fc3\u3068\u3057\u3066\u4ed5\u69d8\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306a\u306e\u3067\u3001\u305d\u308c\u3092implements\u3057\u305f\u30af\u30e9\u30b9\u3082\u5b58\u5728\u3057\u307e\u3059\u3002<br \/>\n\u5b9f\u969b\u306b\u306f\u3001\u3053\u308c\u3089\u306e\u30af\u30e9\u30b9\u3092\u5229\u7528\u3057\u3066\u3044\u304f\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>List\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u5b9f\u88c5\u3057\u305f\u4ee3\u8868\u7684\u306a\u30af\u30e9\u30b9\u306f\u3001<span class=\"Text-highlight\">ArrayList<\/span>\u3067\u3059\u3002<br \/>\nList\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u5b9f\u88c5\u3057\u305f\u30af\u30e9\u30b9\u306f\u3001\u500b\u6570\u304c\u3042\u3089\u304b\u3058\u3081\u4e88\u6e2c\u3067\u304d\u306a\u3044\u30c7\u30fc\u30bf\u306e\u96c6\u307e\u308a\u3092\u53d6\u308a\u6271\u3046\u306e\u306b\u4fbf\u5229\u3067\u3059\u3002<br \/>\n\u4f8b\u3048\u3070\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3066\u305d\u306e\u30c7\u30fc\u30bf\u3092\u4fdd\u6301\u3059\u308b\u5834\u5408\u3001\u30b7\u30e7\u30c3\u30d4\u30f3\u30b0\u30b5\u30a4\u30c8\u306e\u304a\u8cb7\u3044\u7269\u30ab\u30b4\u306e\u3088\u3046\u306b\u30e6\u30fc\u30b6\u306e\u5165\u529b\u306b\u5fdc\u3058\u3066\u4fdd\u6301\u3059\u308b\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3059\u308b\u5834\u5408\u306a\u3069\u306b\u5229\u7528\u3055\u308c\u307e\u3059\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-4-1\"><span class=\"Num\">4.1.<\/span>\u4e3b\u8981\u30e1\u30bd\u30c3\u30c9<\/h4>\n<p>List\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306f\u3001\u8ffd\u52a0\u3001\u633f\u5165\u3001\u524a\u9664\u3001\u691c\u7d22\u3001\u30e9\u30f3\u30c0\u30e0\u30a2\u30af\u30bb\u30b9\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u5b9a\u7fa9\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u304c\u4e3b\u8981\u306a\u30e1\u30bd\u30c3\u30c9\u306e\u4e00\u89a7\u3067\u3059\u3002<\/p>\n<table class=\"Base-table\">\n<colgroup>\n<col>\n<col>\n<col>\n\t<\/colgroup>\n<thead>\n<tr>\n<th class=\"Nowrap\">\u623b\u308a\u5024<\/th>\n<th class=\"Nowrap\">\u30e1\u30bd\u30c3\u30c9\u540d<\/th>\n<th>\u6982\u8981<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td class=\"Nowrap\">boolean<\/td>\n<td class=\"Nowrap\">add(Object)<\/td>\n<td>\u30ea\u30b9\u30c8\u306e\u6700\u5f8c\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8ffd\u52a0\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">boolean<\/td>\n<td class=\"Nowrap\">add(int, Object)<\/td>\n<td>\u7b2c1\u5f15\u6570\u3067\u6307\u5b9a\u3055\u308c\u305f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8ffd\u52a0\u3057\u307e\u3059<br \/>\n\t\t\t\t\u203b \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f0\u304b\u3089\u59cb\u307e\u308a\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">boolean<\/td>\n<td class=\"Nowrap\">contains(Object)<\/td>\n<td>\u5f15\u6570\u3067\u6307\u5b9a\u3055\u308c\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u5834\u5408\u306b\u300ctrue\u300d\u3092\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">boolean<\/td>\n<td class=\"Nowrap\">isEmpty()<\/td>\n<td>\u30ea\u30b9\u30c8\u306b\u8981\u7d20\u304c\u306a\u3044\u5834\u5408\u306b\u300ctrue\u300d\u3092\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">Object<\/td>\n<td class=\"Nowrap\">get(int)<\/td>\n<td>\u5f15\u6570\u3067\u6307\u5b9a\u3055\u308c\u305f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u3042\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">Object<\/td>\n<td class=\"Nowrap\">remove(int)<\/td>\n<td>\u5f15\u6570\u3067\u6307\u5b9a\u3055\u308c\u305f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u3042\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u524a\u9664\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">Object<\/td>\n<td class=\"Nowrap\">set(int, Object)<\/td>\n<td>\u7b2c1\u5f15\u6570\u3067\u6307\u5b9a\u3055\u308c\u305f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u3042\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u3001\u7b2c2\u5f15\u6570\u306e\u3082\u306e\u3067\u7f6e\u63db\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">int<\/td>\n<td class=\"Nowrap\">size()<\/td>\n<td>\u30ea\u30b9\u30c8\u306e\u8981\u7d20\u6570\u3092\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>ArrayList\u30af\u30e9\u30b9\u306f\u3053\u308c\u3089\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u5b9f\u88c5\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>ArrayList\u30af\u30e9\u30b9\u306e\u4f7f\u7528\u8aac\u660e\u306e\u524d\u306b\u3001JDK5\u304b\u3089\u8ffd\u52a0\u3055\u308c\u305f\u6587\u6cd5\u306e\u300cGenerics\uff08\u7dcf\u79f0\uff09\u300d\u306b\u3064\u3044\u3066\u8aac\u660e\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-4-2\"><span class=\"Num\">4.2.<\/span>Generics\uff08\u7dcf\u79f0\u578b\uff09<\/h4>\n<p>Generics\uff08\u30b8\u30a7\u30cd\u30ea\u30af\u30b9\uff09\u306fJDK5\u304b\u3089\u8ffd\u52a0\u3055\u308c\u305f\u6587\u6cd5\u3067\u3059\u3002<br \/>\n\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u306b\u306f\u57fa\u672c\u30c7\u30fc\u30bf\u578b\u3092\u683c\u7d0d\u3067\u304d\u307e\u305b\u3093\u304c\u3001\u9006\u306b\u8a00\u3048\u3070\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3042\u308c\u3070\u4f55\u3067\u3082\u683c\u7d0d\u3067\u304d\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u306f\u8ffd\u52a0\u3057\u305f\u8981\u7d20\u306e\u51fa\u3057\u5165\u308c\u306f\u3001\u5168\u3066Object\u578b\u3068\u3057\u3066\u6271\u3044\u307e\u3059\u3002<br \/>\n\u305d\u306e\u305f\u3081\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u304b\u3089\u5024\u3092\u53d6\u5f97\u3059\u308b\u5834\u5408\u3001\u5024\u306f\u5168\u3066Object\u578b\u3068\u3057\u3066\u53d6\u5f97\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\nObject\u578b\u306e\u72b6\u614b\u3067\u306fString\u578b\u306e\u5909\u6570\u7b49\u306b\u5024\u306e\u683c\u7d0d\u304c\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u306b\u3088\u308a\u884c\u3048\u307e\u305b\u3093\u306e\u3067\u3001\u53d6\u5f97\u3057\u305f\u5024\u3092String\u7b49\u306e\u5909\u6570\u306b\u683c\u7d0d\u3059\u308b\u5834\u5408\u3001\u30ad\u30e3\u30b9\u30c8\u3092\u884c\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306fJDK5\u3088\u308a\u524d\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306e\u8a18\u8ff0\u65b9\u6cd5\u3067\u3059\uff08\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3067\u3082\u52d5\u4f5c\u3055\u305b\u308b\u3053\u3068\u306f\u53ef\u80fd\u3067\u3059\uff09\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>List list = new ArrayList();\r\nString str = \"\u3042\";\r\nlist.add(str);\r\n\r\n\/\/ String\u578b\u3067List\u306b\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u5024\u304cObject\u578b\u3067\u53d6\u5f97\u3055\u308c\u3066\u3057\u307e\u3046\u305f\u3081String\u578b\u306b\u30ad\u30e3\u30b9\u30c8(\u5909\u63db)\u3057\u3066String\u578b\u306e\u5909\u6570\u306b\u4ee3\u5165\u3059\u308b\r\nString str2 = (String) list.get(0);<\/code><\/pre>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306f\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u307e\u3059\u304c\u3001\u4f8b\u3048\u3070\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306e\u3088\u3046\u306b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30df\u30b9\u304c\u539f\u56e0\u3067\u3001\u30ad\u30e3\u30b9\u30c8\u3092\u884c\u3046\u578b\u3092\u8aa4\u3063\u3066\u3057\u307e\u3063\u305f\u5834\u5408\u306f\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>List list = new ArrayList();\r\nString str = \"\u3042\";\r\nlist.add(str);\r\n\r\n\/\/ String\u578b\u3067List\u306b\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u5024\u3092Integer\u578b\u306b\u30ad\u30e3\u30b9\u30c8(\u5909\u63db)\u3059\u308b\u305f\u3081\u4f8b\u5916\u304c\u767a\u751f\r\nInteger i = (Integer) list.get(0);<\/code><\/pre>\n<p>\u3053\u306e\u5834\u5408\u3001String\u578b\u3067\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u5024\u3092Integer\u578b\u3067\u30ad\u30e3\u30b9\u30c8\u3092\u884c\u3063\u3066\u3044\u308b\u306e\u3067\u3001java.lang.ClassCastException\uff08\u4f8b\u5916\uff09\u304c\u767a\u751f\u3057\u3001\u51e6\u7406\u304c\u4e2d\u65ad\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\nGenerics\u306f\u3053\u3046\u3044\u3063\u305f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30df\u30b9\u3092\u6e1b\u5c11\u3055\u305b\u308b\u305f\u3081\u8aa4\u3063\u305f\u5024\u306e\u683c\u7d0d\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u3067\u77e5\u3089\u305b\u3066\u304f\u308c\u308b\u5f79\u5272\u3092\u679c\u305f\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<p>\u57fa\u672c\u69cb\u6587\u306f\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u308c\u307e\u3067\u3068\u306f\u5c11\u3057\u7570\u306a\u308b\u66f8\u304d\u65b9\u306a\u306e\u3067\u6ce8\u610f\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>List&lt;\u683c\u7d0d\u3059\u308b\u578b&gt; list = new ArrayList&lt;\u683c\u7d0d\u3059\u308b\u578b&gt;();<\/code><\/pre>\n<p>\u3053\u306e\u5185\u5bb9\u3067\u306fList\u578b\u306e\u5909\u6570list\u306b\u306f\u300c\u683c\u7d0d\u3059\u308b\u578b\u300d\u306e\u5024\u306e\u307f\u3092\u683c\u7d0d\u3059\u308b\u3068\u3044\u3046\u3053\u3068\u3092\u30b3\u30f3\u30d1\u30a4\u30e9\u306b\u5ba3\u8a00\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3068\u3057\u3066String\u578b\u306e\u5024\u306e\u307f\u3092\u683c\u7d0d\u3059\u308bList\u3092\u5ba3\u8a00\u3059\u308b\u5834\u5408\u306f\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>List&lt;String&gt; list = new ArrayList&lt;String&gt;();<\/code><\/pre>\n<p>\u305d\u306e\u305f\u3081\u4e0b\u8a18\u30b3\u30fc\u30c9\u306fGenerics\u306b\u3088\u308b\u5ba3\u8a00\u3092\u884c\u3063\u3066\u3044\u308b\u305f\u3081\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u3068\u306a\u308a\u3001\u5b9f\u884c\u304c\u884c\u3048\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>List&lt;String&gt; list = new ArrayList&lt;String&gt;();\r\nInteger i = Integer.valueOf(100);\r\n\r\n\/\/ String\u578b\u306e\u307f\u683c\u7d0d\u3067\u304d\u308b\u5ba3\u8a00\u3092\u884c\u3063\u3066\u3044\u308bList\u306b\u5bfe\u3057\u3066Integer\u578b\u306e\u5909\u6570\u3092\u683c\u7d0d\u3057\u3088\u3046\u3068\u3057\u305f\u305f\u3081\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\r\nlist.add(i);<\/code><\/pre>\n<p>\u3053\u306e\u3088\u3046\u306bGenerics\u306f\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u683c\u7d0d\u3059\u308b\u578b\u3092\u78ba\u5b9a\u3055\u305b\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<div class=\"Information-block\">\n<div class=\"Information-heading\">\n<div class=\"Google-icon Google-icon--information\"><\/div>\n<div class=\"Information-heading__child\">Information<\/div>\n<\/p><\/div>\n<div class=\"Heading Title Title--xs\">\u30c0\u30a4\u30e4\u30e2\u30f3\u30c9\u6f14\u7b97\u5b50<\/div>\n<p>\tJava7\u3088\u308a\u300c\u683c\u7d0d\u3059\u308b\u578b\u300d\u3092\u7701\u7565\u3059\u308b\u66f8\u304d\u65b9\u3082\u53ef\u80fd\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\t\u300c&lt;&gt;\u300d\u90e8\u5206\u3092\u300c\u30c0\u30a4\u30e4\u30e2\u30f3\u30c9\u6f14\u7b97\u5b50\u300d\u3068\u547c\u3073\u307e\u3059\u3002<br \/>\n\t\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3057\u3001\u5909\u6570\u3078\u4ee3\u5165\u3059\u308b\u969b\u306b\u5229\u7528\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\t\u4e0b\u8a18\u306e\u3088\u3046\u306b\u3001new\u6f14\u7b97\u5b50(\u53f3\u5074)\u3092\u7528\u3044\u3066\u3044\u308b\u90e8\u5206\u306e\u307f\u300c\u683c\u7d0d\u3059\u308b\u578b\u300d\u304c\u7701\u7565\u53ef\u80fd\u3067\u3042\u308b\u3068\u899a\u3048\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>List&lt;String&gt; list = new ArrayList&lt;&gt;();<\/code><\/pre>\n<\/div>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-4-3\"><span class=\"Num\">4.3.<\/span>ArrayList\u30af\u30e9\u30b9<\/h4>\n<p>\u4ee5\u4e0b\u306f\u3001ArrayList\u30af\u30e9\u30b9\u306b\u8981\u7d20\u3092\u8ffd\u52a0\u3057\u3066\u3001\u8ffd\u52a0\u3057\u305f\u30c7\u30fc\u30bf\u3092\u51fa\u529b\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<div class=\"Pre-title\">ListSample.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>import java.util.ArrayList;\r\nimport java.util.List;\r\n\r\npublic class ListSample {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\t\/\/ ArrayList\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\r\n\t\tList&lt;String&gt; list = new ArrayList&lt;String&gt;();\r\n\r\n\t\t\/\/ \u30ea\u30b9\u30c8\u306b\u9805\u76ee\u3092\u8ffd\u52a0\u3057\u307e\u3059\r\n\t\tlist.add(\"\u3042\");\r\n\t\tlist.add(\"\u3044\");\r\n\t\tlist.add(\"\u3046\");\r\n\r\n\t\t\/\/ \u8ffd\u52a0\u3057\u305f\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\u306b\u306f \u62e1\u5f35for\u6587\u3092\u4f7f\u7528\u3057\u307e\u3059\r\n\t\tfor (String str : list) {\r\n\t\t\t\/\/ \u8981\u7d20\u306e\u53d6\u5f97\r\n\t\t\tSystem.out.println(str);\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>ArrayList\u30af\u30e9\u30b9\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u3001\u307e\u305a\u6700\u521d\u306b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3057\u307e\u3059\u3002\u901a\u5e38\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u5909\u6570\u306e\u578b\u306f\u3001List\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3067\u5b9a\u7fa9\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>\/\/ ArrayList\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\r\nList&lt;String&gt; list = new ArrayList&lt;String&gt;();<\/code><\/pre>\n<p>\u307e\u305f\u3001\u8981\u7d20\u306e\u8ffd\u52a0\u306b\u306f\u3001add\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>\/\/ \u30ea\u30b9\u30c8\u306b\u9805\u76ee\u3092\u8ffd\u52a0\u3057\u307e\u3059\r\nlist.add(\"\u3042\");\r\nlist.add(\"\u3044\");\r\nlist.add(\"\u3046\");<\/code><\/pre>\n<p>\u8ffd\u52a0\u3057\u305f\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\u306f\u3001\u62e1\u5f35for\u6587\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>\/\/ \u8ffd\u52a0\u3057\u305f\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\u306b\u306f \u62e1\u5f35for\u6587\u3092\u4f7f\u7528\u3057\u307e\u3059\r\nfor (String str : list) {\r\n\t\/\/ \u8981\u7d20\u306e\u53d6\u5f97\r\n\tSystem.out.println(str);\r\n}<\/code><\/pre>\n<div class=\"Information-block\">\n<div class=\"Information-heading\">\n<div class=\"Google-icon Google-icon--information\"><\/div>\n<div class=\"Information-heading__child\">Information<\/div>\n<\/p><\/div>\n<div class=\"Heading Title Title--xs\">\u30aa\u30fc\u30c8\u30dc\u30af\u30b7\u30f3\u30b0\uff08autoboxing\uff09<\/div>\n<p>\t\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u683c\u7d0d\u3067\u304d\u308b\u30c7\u30fc\u30bf\u306f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u307f\u3067\u3042\u308b\u305f\u3081\u3001int\u306a\u3069\u306e\u57fa\u672c\u578b\u3092\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u683c\u7d0d\u3059\u308b\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u306e\u3088\u3046\u306b\u30e9\u30c3\u30d1\u30fc\u30af\u30e9\u30b9\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u3001\u975e\u5e38\u306b\u9762\u5012\u3067\u3057\u305f\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();\r\nint i = 5;\r\nlist.add(Integer.valueOf(3)); \/\/ int\u578b\u3092Integer\u578b\u306b\u5909\u6570\u3057\u3066\u30ea\u30b9\u30c8\u306b\u683c\u7d0d\r\nlist.add(Integer.valueOf(i)); \/\/ int\u578b\u3092Integer\u578b\u306b\u5909\u6570\u3057\u3066\u30ea\u30b9\u30c8\u306b\u683c\u7d0d<\/code><\/pre>\n<p>\t\u3057\u304b\u3057\u3001JDK5\u304b\u3089\u306f\u30aa\u30fc\u30c8\u30dc\u30af\u30b7\u30f3\u30b0\u6a5f\u80fd\u3068\u3044\u3046\u65b0\u6a5f\u80fd\u304c\u8ffd\u52a0\u3055\u308c\u305f\u3053\u3068\u306b\u3088\u308a\u3001\u9762\u5012\u306a\u51e6\u7406\u304c\u4e0d\u8981\u3068\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\t\u3053\u306e\u6a5f\u80fd\u306f\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u306b\u57fa\u672c\u30c7\u30fc\u30bf\u578b\u3092\u683c\u7d0d\u3059\u308b\u969b\u3001\u81ea\u52d5\u7684\u306b\u5bfe\u5fdc\u3059\u308b\u30e9\u30c3\u30d1\u30fc\u30af\u30e9\u30b9\u306b\u578b\u5909\u63db\u3092\u3057\u3066\u304f\u308c\u308b\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>\t\u30aa\u30fc\u30c8\u30dc\u30af\u30b7\u30f3\u30b0\u6a5f\u80fd\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u306b\u3088\u308a\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();\r\nint i = 5;\r\nlist.add(3); \/\/ \u6574\u6570\u5024\u3092\u30ea\u30b9\u30c8\u306b\u683c\u7d0d\r\nlist.add(i); \/\/ int\u578b\u306e\u5909\u6570\u3092\u30ea\u30b9\u30c8\u306b\u683c\u7d0d<\/code><\/pre>\n<p>\t\u307e\u305f\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u304b\u3089\u5024\u3092\u53d6\u308a\u51fa\u3057\u3066\u57fa\u672c\u578b\u306e\u5909\u6570\u306b\u683c\u7d0d\u3059\u308b\u969b\u3082\u81ea\u52d5\u7684\u306b\u578b\u5909\u63db\u3057\u3066\u304f\u308c\u307e\u3059\u3002<br \/>\n\t\u3053\u306e\u6a5f\u80fd\u3092\u30aa\u30fc\u30c8\u30a2\u30f3\u30dc\u30af\u30b7\u30f3\u30b0\u3068\u3044\u3044\u307e\u3059\u3002<\/p>\n<p>\t\u4ee5\u4e0b\u306f\u30aa\u30fc\u30c8\u30a2\u30f3\u30dc\u30af\u30b7\u30f3\u30b0\u3092\u4f7f\u7528\u3057\u3066\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u304b\u3089\u53d6\u308a\u51fa\u3057\u305f\u5024\u3092\u57fa\u672c\u578b\u306b\u683c\u7d0d\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();\r\nlist.add(3); \/\/ \u6574\u6570\u5024\u3092\u30ea\u30b9\u30c8\u306b\u683c\u7d0d\r\nint i = list.get(0); \/\/ \u30ea\u30b9\u30c8\u306e\u5148\u982d\u8981\u7d20\u3092int\u578b\u306e\u5909\u6570\u306b\u683c\u7d0d<\/code><\/pre>\n<p>\t\u6ce8\u610f\u70b9\u3068\u3057\u3066\u306f\u3001\u30aa\u30fc\u30c8\u30dc\u30af\u30b7\u30f3\u30b0\u6a5f\u80fd\u306b\u3088\u308a\u3042\u305f\u304b\u3082\u57fa\u672c\u30c7\u30fc\u30bf\u578b\u3092\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u683c\u7d0d\u3059\u308b\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u304c\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u306b\u683c\u7d0d\u3067\u304d\u308b\u30c7\u30fc\u30bf\u306f\u3042\u304f\u307e\u3067\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u307f\u3001\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<br \/>\n\t\u30e9\u30c3\u30d1\u30fc\u30af\u30e9\u30b9\u304c\u57fa\u672c\u30c7\u30fc\u30bf\u578b\u306b\u53d6\u3063\u3066\u4ee3\u308f\u3089\u308c\u305f\u308f\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u5e38\u306b\u5185\u90e8\u3067\u306f\u578b\u5909\u63db\u304c\u884c\u308f\u308c\u3066\u3044\u308b\u3068\u3044\u3046\u3068\u3053\u308d\u306b\u6ce8\u610f\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n<\/p><\/div>\n<p>List\u306b\u95a2\u3059\u308b\u8aac\u660e\u306f\u4ee5\u4e0a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"Separator\">\n<div class=\"Separator__child\"><\/div>\n<\/div>\n<h3 class=\"Heading Title Title--m\" id=\"Bookmark-5\"><span class=\"Num\">5.<\/span>java.util.Map\uff08\u30de\u30c3\u30d7\uff09<\/h3>\n<p>java.util.Map\u306f\u3001\u30ad\u30fc\u3068\u30c7\u30fc\u30bf\u3092\u95a2\u9023\u4ed8\u3051\u3066\u4fdd\u5b58\u3059\u308b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3067\u3059\u3002Map\u306e\u30ad\u30fc\u306b\u5bfe\u3057\u3066\u4fdd\u6301\u3067\u304d\u308b\u5024\u306f1\u3064\u3067\u3059\u3002<br \/>\nMap\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u5b9f\u88c5\u3057\u305f\u30af\u30e9\u30b9\u306f\u3001\u30ad\u30fc\u3068\u306a\u308b\u5024\u304b\u3089\u5bfe\u5fdc\u3059\u308b\u5024\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u306b\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-5-1\"><span class=\"Num\">5.1.<\/span>\u4e3b\u8981\u30e1\u30bd\u30c3\u30c9<\/h4>\n<p>\u4ee5\u4e0b\u306fjava.util.Map\u306e\u4e3b\u8981\u306a\u30e1\u30bd\u30c3\u30c9\u4e00\u89a7\u3067\u3059\u3002<\/p>\n<table class=\"Base-table\">\n<colgroup>\n<col>\n<col>\n<col>\n\t<\/colgroup>\n<thead>\n<tr>\n<th class=\"Nowrap\">\u623b\u308a\u5024<\/th>\n<th class=\"Nowrap\">\u30e1\u30bd\u30c3\u30c9\u540d<\/th>\n<th>\u6982\u8981<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td class=\"Nowrap\">Object<\/td>\n<td class=\"Nowrap\">get(Object)<\/td>\n<td>\u5f15\u6570\u3067\u6307\u5b9a\u3055\u308c\u305f\u30ad\u30fc\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u30c7\u30fc\u30bf\u3092\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">Object<\/td>\n<td class=\"Nowrap\">put(Object, Object)<\/td>\n<td>\u7b2c1\u5f15\u6570\u3092\u5f15\u6570\u3092\u30ad\u30fc\u3068\u3057\u3066\u3001\u7b2c2\u5f15\u6570\u306e\u30c7\u30fc\u30bf\u3092\u95a2\u9023\u4ed8\u3051\u3057\u3001\u3059\u3067\u306b\u5024\u304c\u3042\u308b\u5834\u5408\u3001\u7f6e\u304d\u63db\u3048\u307e\u3059\t<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">Object<\/td>\n<td class=\"Nowrap\">remove(Object)<\/td>\n<td>\u5f15\u6570\u3067\u6307\u5b9a\u3055\u308c\u305f\u30ad\u30fc\u306b\u5bfe\u3057\u3066\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u30c7\u30fc\u30bf\u304c\u3042\u308b\u5834\u5408\u3001\u305d\u308c\u3092\u524a\u9664\u3057\u307e\u3059\u3002\u623b\u308a\u5024\u306f\u524a\u9664\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3067\u3059\t<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">void<\/td>\n<td class=\"Nowrap\">clear()<\/td>\n<td>\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u5024\u3092\u30ad\u30fc\u3082\u542b\u3081\u3066\u524a\u9664\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">Set<\/td>\n<td class=\"Nowrap\">keySet()<\/td>\n<td>\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u30ad\u30fc\u3092Set\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">Collection<\/td>\n<td class=\"Nowrap\">values()<\/td>\n<td>\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u5024\u3092Collection\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">Set<\/td>\n<td class=\"Nowrap\">entrySet()<\/td>\n<td>\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u30ad\u30fc\u3068\u5024\u306e\u30da\u30a2\u3092Set\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">boolean<\/td>\n<td class=\"Nowrap\">containsKey(Object)<\/td>\n<td>\u5f15\u6570\u3067\u6307\u5b9a\u3055\u308c\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u30ad\u30fc\u3068\u3057\u3066\u5b58\u5728\u3059\u308b\u5834\u5408\u306btrue\u3092\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">boolean<\/td>\n<td class=\"Nowrap\">containsValue(Object)<\/td>\n<td>\u5f15\u6570\u3067\u6307\u5b9a\u3055\u308c\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u30c7\u30fc\u30bf\u3068\u3057\u3066\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306btrue\u3092\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">int<\/td>\n<td class=\"Nowrap\">size()<\/td>\n<td>\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u30c7\u30fc\u30bf\u306e\u500b\u6570\u3092\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Map\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u5b9f\u88c5\u3059\u308b\u30af\u30e9\u30b9\u3067\u3001\u5fc5\u305a\u3057\u3082\u3059\u3079\u3066\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u4f7f\u3048\u308b\u3068\u306f\u9650\u308a\u307e\u305b\u3093\u3002\u4f7f\u3048\u306a\u3044\u5834\u5408\u306b\u306f\u3001<br \/>\njava.lang.UnsupportedOperationException\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3059\u306e\u3067\u3001\u6ce8\u610f\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-5-2\"><span class=\"Num\">5.2.<\/span>HashMap\u30af\u30e9\u30b9<\/h4>\n<p>Map\u3092\u5b9f\u88c5\u3057\u305f\u30af\u30e9\u30b9\u3067\u6700\u3082\u5229\u7528\u3059\u308b\u306e\u304cHashMap\u3067\u3059\u3002<\/p>\n<h5 class=\"Heading Title Title--xs\" id=\"Bookmark-5-2-1\"><span class=\"Num\">5.2.1.<\/span>\u30ad\u30fc\u304b\u3089\u5024\u3092\u691c\u7d22<\/h5>\n<p>Map\u306e\u5834\u5408\u3001\u30ad\u30fc\u304b\u3089\u5024\u3092\u691c\u7d22\u3057\u3066\u53d6\u5f97\u3059\u308b\u51e6\u7406\u304c\u4e00\u756a\u591a\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002<br \/>\n\u30ad\u30fc\u3068\u5024\u306e\u8ffd\u52a0\u306f\u3001put\u30e1\u30bd\u30c3\u30c9\u3001\u5024\u306e\u691c\u7d22\u306f\u3001get\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306fput\u30e1\u30bd\u30c3\u30c9\u3067\u30ad\u30fc\u3068\u5024\u3092\u8ffd\u52a0\u3057\u3001get\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3057\u3066\u30ad\u30fc\u306b\u4e00\u81f4\u3059\u308b\u5024\u3092\u53d6\u5f97\u3057\u3066\u3044\u308b\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<div class=\"Pre-title\">MapSample.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>import java.util.HashMap;\r\nimport java.util.Map;\r\n\r\npublic class MapSample {\r\n\r\n\tpublic static void main(String[] args) {\r\n\r\n\t\tMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();\r\n\t\tmap.put(\"\u5927\u962a\u5e9c\", \"\u5927\u962a\u5e02\");\r\n\t\tmap.put(\"\u5175\u5eab\u770c\", \"\u795e\u6238\u5e02\");\r\n\t\tmap.put(\"\u6ecb\u8cc0\u770c\", \"\u5927\u6d25\u5e02\");\r\n\r\n\t\t\/\/ \u5175\u5eab\u770c\u3092\u30ad\u30fc\u3068\u3057\u305f\u5834\u5408\u306e\u5024\u3092\u53d6\u5f97\u3059\u308b\r\n\t\tString val = map.get(\"\u5175\u5eab\u770c\");\r\n\t\tSystem.out.println(\"val = \" + val);\r\n\r\n\t\t\/\/ \u30ad\u30fc\u306b\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u306f null \u304c\u53d6\u5f97\u3055\u308c\u308b\r\n\t\tval = map.get(\"\u6771\u4eac\u90fd\");\r\n\t\tSystem.out.println(\"val = \" + val);\r\n\t}\r\n}<\/code><\/pre>\n<p>\u307e\u305a\u3001HashMap\u30af\u30e9\u30b9\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u751f\u6210\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002List\u306e\u3068\u304d\u3068\u540c\u69d8\u3067\u3001\u578b\u306fMap\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3067\u5b9a\u7fa9\u3059\u308b\u306e\u304c\u901a\u5e38\u3067\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>\/\/ HashMap\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\r\nMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();<\/code><\/pre>\n<p>\u3053\u3053\u3067\u3082HashMap\u306b\u5bfe\u3057\u3066Generics\u306b\u3088\u308b\u578b\u6307\u5b9a\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002List\u306e\u6642\u3068\u7570\u306a\u308a\u3001\u6307\u5b9a\u3057\u3066\u3044\u308b\u578b\u304c\u8907\u6570\u3042\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u4e0b\u3055\u3044\u3002<br \/>\nList\u306e\u5834\u5408\u306f\u683c\u7d0d\u3059\u308b\u5024\u304c1\u3064\u3060\u3051\u3067\u3057\u305f\u306e\u3067\u3001Generics\u306b\u3088\u308b\u683c\u7d0d\u3059\u308b\u5024\u306e\u578b\u3092\u6307\u5b9a\u3059\u308b\u8a18\u8ff0\u306f1\u3064\u3067\u3057\u305f\u3002\u3057\u304b\u3057\u3001Map\u306f\u5024\u3092\u30ad\u30fc\u3068\u5024\u306e2\u3064\u683c\u7d0d\u3059\u308b\u305f\u3081\u3001\u6307\u5b9a\u3059\u308b\u578b\u30822\u3064\u5b58\u5728\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u304cHashMap\u30af\u30e9\u30b9\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3059\u308b\u8a18\u8ff0\u3067\u3059\u3002\u30de\u30c3\u30d7\u306f\u3001\u30ad\u30fc\u3068\u5024\u306e2\u3064\u306e\u30c7\u30fc\u30bf\u3092\u30bb\u30c3\u30c8\u3067\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>\/\/ map\u306b\u30ad\u30fc\u3068\u5024\u306e\u30bb\u30c3\u30c8\u3067\u30c7\u30fc\u30bf\u8ffd\u52a0\r\nmap.put(\"\u5927\u962a\u5e9c\", \"\u5927\u962a\u5e02\");\r\nmap.put(\"\u5175\u5eab\u770c\", \"\u795e\u6238\u5e02\");\r\nmap.put(\"\u6ecb\u8cc0\u770c\", \"\u5927\u6d25\u5e02\");<\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u8a18\u8ff0\u304c\u30ad\u30fc\u304b\u3089\u5024\u3092\u53d6\u5f97\u3057\u3066\u3044\u308b\u90e8\u5206\u3067\u3059\u3002get\u30e1\u30bd\u30c3\u30c9\u306e\u5f15\u6570\u306b\u691c\u7d22\u306e\u30ad\u30fc\u3068\u306a\u308b\u5024\u3092\u30bb\u30c3\u30c8\u3059\u308b\u3068\u3001\u305d\u308c\u306b\u898b\u5408\u3046\u5024\u304c\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>\/\/ \u5175\u5eab\u770c\u3092\u30ad\u30fc\u3068\u3057\u305f\u5834\u5408\u306e\u5024\u3092\u53d6\u5f97\u3059\u308b\r\nString val = map.get(\"\u5175\u5eab\u770c\");\r\nSystem.out.println(\"val = \" + val);<\/code><\/pre>\n<h5 class=\"Heading Title Title--xs\" id=\"Bookmark-5-2-2\"><span class=\"Num\">5.2.2.<\/span>\u30ad\u30fc\u3068\u5024\u306e\u53d6\u5f97<\/h5>\n<p>Map\u306b\u683c\u7d0d\u3055\u308c\u305f\u30ad\u30fc\u3092\u5168\u4ef6\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u306f\u3001keySet\u30e1\u30bd\u30c3\u30c9\u3001\u5024\u3092\u5168\u4ef6\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u306f\u3001values\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u304ckeySet\u30e1\u30bd\u30c3\u30c9\u3001values\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u305f\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<div class=\"Pre-title\">MapSample2.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>import java.util.HashMap;\r\nimport java.util.Map;\r\n\r\npublic class MapSample2 {\r\n\r\n\tpublic static void main(String[] args) {\r\n\r\n\t\tMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();\r\n\t\tmap.put(\"\u5927\u962a\u5e9c\", \"\u5927\u962a\u5e02\");\r\n\t\tmap.put(\"\u5175\u5eab\u770c\", \"\u795e\u6238\u5e02\");\r\n\t\tmap.put(\"\u6ecb\u8cc0\u770c\", \"\u5927\u6d25\u5e02\");\r\n\r\n\t\t\/\/ keySet\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3057\u3066\u30ad\u30fc\u3092\u5168\u4ef6\u53d6\u5f97\u3059\u308b\r\n\t\tfor (String key : map.keySet()) {\r\n\t\t\tSystem.out.println(key);\r\n\t\t}\r\n\r\n\t\t\/\/ values\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3057\u3066\u5024\u3092\u5168\u4ef6\u53d6\u5f97\u3059\u308b\r\n\t\tfor (String value : map.values()) {\r\n\t\t\tSystem.out.println(value);\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>\u307e\u305f\u3001\u30ad\u30fc\u3068\u5024\u306e\u4e21\u65b9\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f\u3001entrySet\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u304centrySet\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u305f\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<div class=\"Pre-title\">MapSample3.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>import java.util.HashMap;\r\nimport java.util.Map;\r\n\r\npublic class MapSample3 {\r\n\r\n\tpublic static void main(String[] args) {\r\n\r\n\t\tMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();\r\n\t\tmap.put(\"\u5927\u962a\u5e9c\", \"\u5927\u962a\u5e02\");\r\n\t\tmap.put(\"\u5175\u5eab\u770c\", \"\u795e\u6238\u5e02\");\r\n\t\tmap.put(\"\u6ecb\u8cc0\u770c\", \"\u5927\u6d25\u5e02\");\r\n\r\n\t\t\/\/ entrySet\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3057\u3066\u30ad\u30fc\u3068\u5024\u3092\u5168\u4ef6\u53d6\u5f97\u3059\u308b\r\n\t\tfor (Map.Entry&lt;String, String&gt; entry : map.entrySet() ) {\r\n\r\n\t\t\t\/\/ Map.Entry\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u306egetKey\u30e1\u30bd\u30c3\u30c9\u3067\u30ad\u30fc\u3092\u53d6\u5f97\u3059\u308b\r\n\t\t\tString key = entry.getKey();\r\n\t\t\tSystem.out.println(key);\r\n\r\n\t\t\t\/\/ Map.Entry\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u306egetValue\u30e1\u30bd\u30c3\u30c9\u3067\u5024\u3092\u53d6\u5f97\u3059\u308b\r\n\t\t\tString value = entry.getValue();\r\n\t\t\tSystem.out.println(value);\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>HashMap\u30af\u30e9\u30b9\u306e\u8aac\u660e\u306f\u4ee5\u4e0a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-5-3\"><span class=\"Num\">5.3.<\/span>HashMap\u4ee5\u5916\u306eMap<\/h4>\n<p>java.util.HashMap\u30af\u30e9\u30b9\u306e\u4ed6\u306b\u3082Map\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u5b9f\u88c5\u3057\u305f\u30af\u30e9\u30b9\u304c\u5b58\u5728\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u304c\u305d\u308c\u3089\u306e\u30af\u30e9\u30b9\u3067\u3059\u3002<\/p>\n<table class=\"Base-table\">\n<colgroup>\n<col>\n<col>\n\t<\/colgroup>\n<thead>\n<tr>\n<th class=\"Nowrap\">\u30af\u30e9\u30b9\u540d<\/th>\n<th>\u7279\u5fb4<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td class=\"Nowrap\">HashMap<\/td>\n<td>\u6700\u3082\u3088\u304f\u5229\u7528\u3059\u308bMap\u3002\u901a\u5e38\u306f\u3053\u308c\u3092\u4f7f\u3044\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">Hashtable<\/td>\n<td>\u53e4\u3044Map\u3002\u540c\u671f\u3059\u308b\u306e\u304c\u7279\u5fb4\u3067\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">TreeMap<\/td>\n<td>\u30ad\u30fc\u304c\u8f9e\u66f8\u9806\u306b\u30bd\u30fc\u30c8\uff08\u4e26\u3073\u66ff\u3048\uff09\u3055\u308c\u3066\u3044\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">LinkedHashMap<\/td>\n<td>\u30ad\u30fc\u304c\u8ffd\u52a0\u3057\u305f\u9806\u756a\u306b\u4e26\u3093\u3067\u3044\u307e\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">IdentityHashMap<\/td>\n<td>\u901a\u5e38\u306eMap\u306fequals\u306b\u3088\u308a\u30ad\u30fc\u306e\u540c\u4e00\u3092\u78ba\u8a8d\u3057\u307e\u3059\u304c\u3001\u3053\u308c\u306f==\u3092\u5229\u7528\u3057\u307e\u3059\t<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Map\u306b\u95a2\u3059\u308b\u8aac\u660e\u306f\u4ee5\u4e0a\u3067\u3059\u3002<\/p>\n<div class=\"Separator\">\n<div class=\"Separator__child\"><\/div>\n<\/div>\n<h3 class=\"Heading Title Title--m\" id=\"Bookmark-6\"><span class=\"Num\">6.<\/span>java.util.Set\uff08\u30bb\u30c3\u30c8\uff09<\/h3>\n<p>java.util.Set\u306f\u3001List\u540c\u69d8\u8907\u6570\u306e\u5024\u3092\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306a\u3069\u3068\u95a2\u9023\u4ed8\u3051\u305a\u306b\u8a18\u61b6\u3059\u308b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u3067\u3059\u3002<br \/>\nList\u3068\u306e\u9055\u3044\u306f\u91cd\u8907\u3057\u3066\u540c\u3058\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4fdd\u6301\u3067\u304d\u306a\u3044\u70b9\u3067\u3059\u3002<br \/>\nhashCode\u30e1\u30bd\u30c3\u30c9\u306e\u5024\u304c\u540c\u3058\u3067\u3001\u304b\u3064equals\u30e1\u30bd\u30c3\u30c9\u304ctrue\u3067\u3042\u308b\u5834\u5408\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u540c\u4e00\u3068\u5224\u65ad\u3055\u308c\u3001\u5f8c\u304b\u3089\u8ffd\u52a0\u3057\u305f\u5024\u3067\u4e0a\u66f8\u304d\u3055\u308c\u307e\u3059\u3002<br \/>\nSet\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u5b9f\u88c5\u3059\u308b\u30af\u30e9\u30b9\u306b\u306f\u3001java.util.HashSet\u3001java.util.TreeSet\u3001java.util.LinkedHashSet\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-6-1\"><span class=\"Num\">6.1.<\/span>\u4e3b\u8981\u30e1\u30bd\u30c3\u30c9<\/h4>\n<p>\u4ee5\u4e0b\u304cSet\u306e\u4e3b\u8981\u306a\u30e1\u30bd\u30c3\u30c9\u306e\u4e00\u89a7\u3067\u3059\u3002<\/p>\n<table class=\"Base-table\">\n<colgroup>\n<col>\n<col>\n<col>\n\t<\/colgroup>\n<thead>\n<tr>\n<th class=\"Nowrap\">\u623b\u308a\u5024<\/th>\n<th class=\"Nowrap\">\u30e1\u30bd\u30c3\u30c9\u540d<\/th>\n<th>\u6982\u8981<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td class=\"Nowrap\">boolean<\/td>\n<td class=\"Nowrap\">add(Object)<\/td>\n<td>\u5f15\u6570\u3067\u6307\u5b9a\u3055\u308c\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u30bb\u30c3\u30c8\u306b\u542b\u307e\u308c\u306a\u3044\u5834\u5408\u3001\u30bb\u30c3\u30c8\u306b\u8ffd\u52a0\u3057\u3001\u8ffd\u52a0\u3055\u308c\u305f\u5834\u5408true\u3092\u8fd4\u3057\u307e\u3059\t<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">boolean<\/td>\n<td class=\"Nowrap\">contains(Object)<\/td>\n<td>\u5f15\u6570\u3067\u6307\u5b9a\u3055\u308c\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u5834\u5408\u306btrue\u3092\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">void<\/td>\n<td class=\"Nowrap\">clear()<\/td>\n<td>\u3059\u3079\u3066\u306e\u8981\u7d20\u3092\u524a\u9664\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">boolean<\/td>\n<td class=\"Nowrap\">remove(Object)<\/td>\n<td>\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u524a\u9664\u3057\u3001\u6307\u5b9a\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u30bb\u30c3\u30c8\u5185\u306b\u3042\u308b\u5834\u5408true\u3092\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">int<\/td>\n<td class=\"Nowrap\">size()<\/td>\n<td>\u8981\u7d20\u6570\u3092\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">Object[]<\/td>\n<td class=\"Nowrap\">toArray(Object[])<\/td>\n<td>\u30bb\u30c3\u30c8\u3092\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u578b\u306e\u914d\u5217\u306b\u5909\u63db\u3057\u3066\u8fd4\u3057\u307e\u3059<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-6-2\"><span class=\"Num\">6.2.<\/span>HashSet\u30af\u30e9\u30b9<\/h4>\n<p>Set\u3092\u5b9f\u88c5\u3057\u3066\u3044\u308b\u4ee3\u8868\u7684\u306a\u30af\u30e9\u30b9\u306f\u3001HashSet\u30af\u30e9\u30b9\u3067\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u304cHashSet\u30af\u30e9\u30b9\u3092\u4f7f\u3063\u305f\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<div class=\"Pre-title\">SetSample.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>import java.util.HashSet;\r\nimport java.util.Set;\r\n\r\npublic class SetSample {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\t\/\/ HashSet\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\r\n\t\t\/\/ \u5de6\u5074\u306e\u578b\u304c Set \u578b\u3067\u3042\u308b\u4e8b\u306b\u6ce8\u76ee\u3057\u3066\u304f\u3060\u3055\u3044\r\n\t\tSet&lt;String&gt; set = new HashSet&lt;String&gt;();\r\n\r\n\t\t\/\/ set\u306b\u9805\u76ee\u3092\u8ffd\u52a0\u3057\u307e\u3059\r\n\t\tset.add(\"\u3042\");\r\n\t\tset.add(\"\u3044\");\r\n\t\tset.add(\"\u3046\");\r\n\r\n\t\t\/\/ \u8ffd\u52a0\u3057\u305f\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\u306b\u306f \u62e1\u5f35for\u6587 \u3092\u4f7f\u7528\u3057\u307e\u3059\r\n\t\tfor (String str : set) {\r\n\t\t\t\/\/ \u8981\u7d20\u306e\u53d6\u5f97\r\n\t\t\tSystem.out.println(str);\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>\u30e1\u30bd\u30c3\u30c9\u4e00\u89a7\u304b\u3089\u308f\u304b\u308b\u3068\u304a\u308a\u3001Set\u306b\u306f\u7279\u5b9a\u306e\u8981\u7d20\u3092\u53d6\u308a\u51fa\u3059\u30e1\u30bd\u30c3\u30c9\u304c\u3042\u308a\u307e\u305b\u3093\u3002\u8981\u7d20\u306e\u53d6\u5f97\u306b\u306f\u62e1\u5f35for\u6587\u3092\u4f7f\u7528\u3057\u3066\u9806\u756a\u306b\u53d6\u5f97\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\nHashSet\u3092\u5229\u7528\u3057\u305f\u5834\u5408\u3069\u306e\u3088\u3046\u306a\u9806\u756a\u3067\u51fa\u529b\u3055\u308c\u308b\u304b\u306f\u308f\u304b\u308a\u307e\u305b\u3093\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-6-3\"><span class=\"Num\">6.3.<\/span>HashSet\u30af\u30e9\u30b9\u4ee5\u5916\u306eSet<\/h4>\n<p>java.util.HashSet\u30af\u30e9\u30b9\u306e\u4ed6\u306b\u3082Set\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u5b9f\u88c5\u3057\u305f\u30af\u30e9\u30b9\u304c\u5b58\u5728\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u304c\u305d\u308c\u3089\u306e\u30af\u30e9\u30b9\u3067\u3059\u3002<\/p>\n<table class=\"Base-table\">\n<colgroup>\n<col>\n<col>\n\t<\/colgroup>\n<thead>\n<tr>\n<th class=\"Nowrap\">\u30af\u30e9\u30b9\u540d<\/th>\n<th>\u7279\u5fb4<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td class=\"Nowrap\">HashSet<\/td>\n<td>\u6700\u3082\u3088\u304f\u5229\u7528\u3059\u308bSet\u3002\u901a\u5e38\u306f\u3053\u308c\u3092\u4f7f\u3044\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">TreeSet<\/td>\n<td>\u5024\u304c\u8f9e\u66f8\u9806\u306b\u30bd\u30fc\u30c8\uff08\u4e26\u3073\u66ff\u3048\uff09\u3055\u308c\u3066\u3044\u307e\u3059<\/td>\n<\/tr>\n<tr>\n<td class=\"Nowrap\">LinkedHashSet<\/td>\n<td>\u5024\u304c\u8ffd\u52a0\u3057\u305f\u9806\u756a\u306b\u4e26\u3093\u3067\u3044\u307e\u3059\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Set\u306e\u8aac\u660e\u306f\u4ee5\u4e0a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"Separator\">\n<div class=\"Separator__child\"><\/div>\n<\/div>\n<h3 class=\"Heading Title Title--m\" id=\"Bookmark-7\"><span class=\"Num\">7.<\/span>\u7df4\u7fd2\u554f\u984c1<\/h3>\n<p>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u7df4\u7fd2\u554f\u984c\u3067\u3059\u3002<\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-7-1\"><span class=\"Num\">7.1.<\/span>\u554f\u984c1<\/h4>\n<p>\u300c\u308a\u3093\u3054\u300d\u3001\u300c\u30d0\u30ca\u30ca\u300d\u3001\u300c\u306a\u3057\u300d\u3001\u300c\u3082\u3082\u300d\u3092List\u306b\u8ffd\u52a0\u3057\u3001\u62e1\u5f35for\u6587\u3092\u4f7f\u7528\u3057\u3066\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u8868\u793a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div class=\"Answer-block\">\n\t<input class=\"SW\" type=\"checkbox\" id=\"Answer-content-1\"><label for=\"Answer-content-1\" class=\"Answer-SW\"><span\n\t\t\tclass=\"Google-icon Google-icon--arrow-single-gray\"><\/span>\u89e3\u7b54\u3092\u8868\u793a\u3059\u308b<\/label><\/p>\n<div class=\"Answer-content\">\n<div class=\"Pre-title\">ListMondai1_1.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>import java.util.ArrayList;\r\nimport java.util.List;\r\n\r\npublic class ListMondai1_1 {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\t\/\/ \u30ea\u30b9\u30c8\u306e\u751f\u6210\r\n\t\tList&lt;String&gt; list = new ArrayList&lt;String&gt;();\r\n\r\n\t\t\/\/ \u30ea\u30b9\u30c8\u306b\u8981\u7d20\u3092\u8ffd\u52a0\r\n\t\tlist.add(\"\u308a\u3093\u3054\");\r\n\t\tlist.add(\"\u30d0\u30ca\u30ca\");\r\n\t\tlist.add(\"\u306a\u3057\");\r\n\t\tlist.add(\"\u3082\u3082\");\r\n\r\n\t\t\/\/ \u683c\u7d0d\u3057\u305f\u30ea\u30b9\u30c8\u306e\u8981\u7d20\u3092\u51fa\u529b\r\n\t\tfor (String str : list) {\r\n\t\t\tSystem.out.println(str);\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<\/p><\/div>\n<\/div>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-7-2\"><span class=\"Num\">7.2.<\/span>\u554f\u984c2<\/h4>\n<p>\u300c\u5165\u51fa\u529b\u30b9\u30c8\u30ea\u30fc\u30e0\u300d\u306e\u7ae0\u306e\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u3092\u53c2\u8003\u306b\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u300c\u308a\u3093\u3054\u300d\u3001\u300c\u30d0\u30ca\u30ca\u300d\u3001\u300c\u306a\u3057\u300d\u3001\u300c\u3082\u3082\u300d\u3092\u9806\u756a\u306b\u5165\u529b\u3067\u304d\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div class=\"Pre-title\">\u56f31 \u5b9f\u884c\u7d50\u679c<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>\u300c!\u300d \uff0b Enter\u3067\u7d42\u4e86\r\n\u3053\u306e\u5f8c\u306b\u5165\u529b &gt;\r\n\u308a\u3093\u3054\r\n\u3053\u306e\u5f8c\u306b\u5165\u529b &gt;\r\n\u30d0\u30ca\u30ca\r\n\u3053\u306e\u5f8c\u306b\u5165\u529b &gt;\r\n\u306a\u3057\r\n\u3053\u306e\u5f8c\u306b\u5165\u529b &gt;\r\n\u3082\u3082<\/code><\/pre>\n<p>\u307e\u305f\u3001\u5165\u529b\u3057\u305f\u5024\u3092List\u306b\u683c\u7d0d\u3057\u3001\u305d\u306e\u3042\u3068\u306b\u62e1\u5f35for\u6587\u3092\u4f7f\u7528\u3057\u3066\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u8868\u793a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div class=\"Answer-block\">\n\t<input class=\"SW\" type=\"checkbox\" id=\"Answer-content-2\"><label for=\"Answer-content-2\" class=\"Answer-SW\"><span\n\t\t\tclass=\"Google-icon Google-icon--arrow-single-gray\"><\/span>\u89e3\u7b54\u3092\u8868\u793a\u3059\u308b<\/label><\/p>\n<div class=\"Answer-content\">\n<div class=\"Pre-title\">ListMondai1_2.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>import java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\npublic class ListMondai1_2 {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\t\/\/ \u30e1\u30c3\u30bb\u30fc\u30b8\u51fa\u529b\r\n\t\tSystem.out.println(\"\u300c!\u300d + Enter\u3067\u7d42\u4e86\");\r\n\r\n\t\t\/\/ \u5165\u529b\u3055\u308c\u305f\u6587\u5b57\u5217\u683c\u7d0d\u7528\u30ea\u30b9\u30c8\u751f\u6210\r\n\t\tList&lt;String&gt; list = new ArrayList&lt;String&gt;();\r\n\r\n\t\tBufferedReader br = null;\r\n\r\n\t\ttry {\r\n\t\t\t\/\/ \u30b3\u30f3\u30bd\u30fc\u30eb\u306e\u5165\u529b\u30c7\u30fc\u30bf\u8aad\u307f\u8fbc\u307f\u6e96\u5099\r\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\r\n\r\n\t\t\t\/\/ \u8aad\u307f\u8fbc\u307f\u683c\u7d0d\u7528\u5909\u6570\u5b9a\u7fa9\r\n\t\t\tString str = \"\";\r\n\r\n\t\t\t\/\/ \u300c!\u300d\u304c\u5165\u529b\u3055\u308c\u308b\u307e\u3067\u8aad\u307f\u8fbc\u307f\u7e70\u308a\u8fd4\u3057\r\n\t\t\twhile (!str.equals(\"!\")) {\r\n\t\t\t\t\/\/ \u30e1\u30c3\u30bb\u30fc\u30b8\u51fa\u529b\r\n\t\t\t\tSystem.out.println(\"\u3053\u306e\u5f8c\u306b\u5165\u529b &gt;\");\r\n\t\t\t\t\/\/ \u30b3\u30f3\u30bd\u30fc\u30eb\u306e\u5165\u529b\u30c7\u30fc\u30bf\u8aad\u307f\u8fbc\u307f\r\n\t\t\t\tstr = br.readLine();\r\n\r\n\t\t\t\t\/\/\u300c!\u300d\u4ee5\u5916\u306e\u5165\u529b\u3057\u305f\u5024\u3092\u30ea\u30b9\u30c8\u306b\u683c\u7d0d\r\n\t\t\t\tif (!str.equals(\"!\")) {\r\n\t\t\t\t\t\tlist.add(str);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t\/\/ \u30ea\u30b9\u30c8\u306e\u5404\u8981\u7d20\u3092\u51fa\u529b\r\n\t\t\tfor (String st : list) {\r\n\t\t\t\tSystem.out.println(st);\r\n\t\t\t}\r\n\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\r\n\t\t} finally {\r\n\t\t\tif (br != null) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\t\/\/ \u8aad\u307f\u8fbc\u307f\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u30af\u30ed\u30fc\u30ba\u3057\u307e\u3059\r\n\t\t\t\t\tbr.close();\r\n\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p>\t\t\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u5165\u529b\u3057\u305f\u5024\u3092\u8aad\u307f\u8fbc\u3080\u51e6\u7406\u306b\u3064\u3044\u3066\u306f\u3001\u300c\u5165\u51fa\u529b\u30b9\u30c8\u30ea\u30fc\u30e0\u300d\u306e\u7ae0\u306e\u30b5\u30f3\u30d7\u30eb\u901a\u308a\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<br \/>\n\t\t\u8aad\u307f\u8fbc\u3093\u3060\u6587\u5b57\u5217\u3092\u30ea\u30b9\u30c8\u306b\u9806\u6b21\u683c\u7d0d\u3057\u3066\u3044\u304d\u307e\u3059\u304c\u3001\u8aad\u307f\u8fbc\u307f\u306e\u7e70\u308a\u8fd4\u3057\u5224\u5b9a\u306b\u4f7f\u7528\u3057\u3066\u3044\u308b\u300c!\u300d\u3092\u30ea\u30b9\u30c8\u306b \u8ffd\u52a0\u3057\u306a\u3044\u3088\u3046\u306b\u3001if\u6587\u3067\u5224\u5b9a\u51e6\u7406\u3092\u5165\u308c\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\t\t\u6700\u5f8c\u306b\u3001\u683c\u7d0d\u3057\u305f\u5404\u8981\u7d20\u3092\u62e1\u5f35for\u6587\u3067\u53d6\u5f97\u3057\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u51fa\u529b\u3057\u307e\u3059\u3002\n\t<\/p><\/div>\n<\/div>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-7-3\"><span class=\"Num\">7.3.<\/span>\u554f\u984c3<\/h4>\n<p>C:\\temp\\mondailist.txt\u3092\u4f5c\u6210\u3057\u3001\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u5165\u529b\u3057\u3066\u4fdd\u5b58\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>\u308a\u3093\u3054\r\n\u30d0\u30ca\u30ca\r\n\u306a\u3057\r\n\u30de\u30b9\u30ab\u30c3\u30c8\r\n\u30e1\u30ed\u30f3\r\n\u30d0\u30ca\u30ca<\/code><\/pre>\n<p>\u305d\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u4ed5\u69d8\u3092\u6e80\u305f\u3059\u30d7\u30ed\u30b0\u30e9\u30e0\u300cListMondai1_3\u300d\u3092\u5b8c\u6210\u3055\u305b\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<ol class=\"Base-list Base-list--ol\">\n<li class=\"Base-list__child\">\u4f5c\u6210\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u307f\u3001\u8aad\u307f\u8fbc\u3093\u3060\u5024\u3092List\u306b\u683c\u7d0d\u3059\u308b\u3002<\/li>\n<li class=\"Base-list__child\">List\u306e\u5185\u5bb9\u3092\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u8868\u793a\u3059\u308b\u3002\u305f\u3060\u3057\u3001\u62e1\u5f35for\u6587\u3067\u306f\u306a\u304f\u901a\u5e38\u306efor\u6587\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3002<\/li>\n<li class=\"Base-list__child\">List\u5185\u3067\u91cd\u8907\u3057\u3066\u3044\u308b\u30c7\u30fc\u30bf\u3092\u9664\u5916\u3059\u308b\u3002<\/li>\n<li class=\"Base-list__child\">\u91cd\u8907\u9664\u5916\u5f8c\u306e\u30c7\u30fc\u30bf\u3092\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u8868\u793a\u3059\u308b\u3002\u3053\u3053\u3067\u306f\u62e1\u5f35for\u6587\u3092\u4f7f\u7528\u3057\u3066\u3082\u3088\u3044\u3053\u3068\u3068\u3059\u308b\u3002<\/li>\n<\/ol>\n<div class=\"Pre-title\">ListMondai1_3.java<\/div>\n<pre class=\"Copy prettyprint lang-js\"><code>import java.io.BufferedReader;\r\nimport java.io.FileReader;\r\nimport java.io.IOException;\r\nimport java.util.ArrayList;\r\nimport java.util.LinkedHashSet;\r\nimport java.util.List;\r\nimport java.util.Set;\r\n\r\npublic class ListMondai1_3 {\r\n\tpublic static void main(String[] args) {\r\n\r\n\r\n\t\tBufferedReader br = null;\r\n\r\n\t\ttry {\r\n\t\t\t\/\/ \u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\u6e96\u5099\r\n\t\t\tbr = new BufferedReader(new FileReader(\"C:\\\\temp\\\\mondailist.txt\"));\r\n\r\n\t\t\t\/\/ \u8aad\u307f\u8fbc\u307f\u683c\u7d0d\u7528\u5909\u6570\u5b9a\u7fa9\r\n\t\t\tString str = \"\";\r\n\r\n\t\t\tList&lt;String&gt; list = new ArrayList&lt;String&gt;();\r\n\t\t\t\/\/ \u8aad\u307f\u8fbc\u307f\u51e6\u7406\r\n\t\t\twhile ((str = br.readLine()) != null) {\r\n\t\t\t\t\t\/* 1. \u3053\u3053\u306b\u300c\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3093\u3060\u5024\u3092List\u306b\u683c\u7d0d\u3059\u308b\u51e6\u7406\u300d\u3092\u8ffd\u8a18 *\/\r\n\t\t\t}\r\n\r\n\t\t\t\/* 2. \u30ea\u30b9\u30c8\u306e\u5185\u5bb9\u3092\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u8868\u793a\u3059\u308b\u51e6\u7406\u3092\u8ffd\u8a18 *\/\r\n\r\n\t\t\tSystem.out.println(\"=====================================\");\r\n\r\n\t\t\t\/* 3. \u30ea\u30b9\u30c8\u306e\u5185\u5bb9\u304b\u3089\u91cd\u8907\u30c7\u30fc\u30bf\u3092\u9664\u5916\u3059\u308b\u51e6\u7406\u3092\u8ffd\u8a18 *\/\r\n\r\n\t\t\t\/* 4. \u91cd\u8907\u9664\u5916\u5f8c\u306e\u30c7\u30fc\u30bf\u3092\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u8868\u793a\u3059\u308b\u51e6\u7406\u3092\u8ffd\u8a18 *\/\r\n\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\r\n\t\t} finally {\r\n\t\t\tif (br != null) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\t\/\/ \u8aad\u307f\u8fbc\u307f\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u30af\u30ed\u30fc\u30ba\u3057\u307e\u3059\r\n\t\t\t\t\tbr.close();\r\n\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}<\/code><\/pre>\n<p><span class=\"Text-highlight\">\u203b\u3053\u306e\u554f\u984c\u306e\u89e3\u7b54\u306f\u63b2\u8f09\u3057\u3066\u304a\u308a\u307e\u305b\u3093\u3002<span class=\"Post-link\" >Tech Fun IT\u30b9\u30af\u30fc\u30eb\u306eJava\u7814\u4fee<\/span>\u3067\u306f\u3001\u8b1b\u5e2b\u304c\u4e01\u5be7\u306b\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/span><br \/>\n<span class=\"Text-red-bold\">\u73fe\u5728Tech Fun IT\u30b9\u30af\u30fc\u30eb\u3067\u306f\u3001\u65b0\u898f\u53d7\u8b1b\u8005\u306e\u52df\u96c6\u306f\u884c\u306a\u3063\u3066\u304a\u308a\u307e\u305b\u3093\u3002<\/span><\/p>\n<h4 class=\"Heading Title Title--s\" id=\"Bookmark-7-4\"><span class=\"Num\">7.4.<\/span>\u554f\u984c4<\/h4>\n<p>\u30ad\u30fc\u304c\u300c\u308a\u3093\u3054\u300d\u3067\u5024\u304c\u300capple\u300d\u3001\u300c\u30d0\u30ca\u30ca\u300d\u3067\u300cbanana\u300d\u3001\u300c\u306a\u3057\u300d\u3067\u300cpear\u300d\u3001\u300c\u3082\u3082\u300d\u3067\u300cpeach\u300d\u3092Map\u306b\u8ffd\u52a0\u3057\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u65e5\u672c\u8a9e\u540d\u3092\u5165\u529b\u3057\u3066\u3001\u305d\u306e\u65e5\u672c\u8a9e\u540d\u306b\u5408\u3063\u305f\u82f1\u8a9e\u540d\u3092\u8868\u793a\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u4ee5\u4e0b\u304c\u5b9f\u884c\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u3002<br \/>\nMap\u306b\u5165\u529b\u3055\u308c\u305f\u65e5\u672c\u8a9e\u540d\u306e\u679c\u7269\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u300c\u308f\u304b\u308a\u307e\u305b\u3093\u3002\u300d\u3092\u8868\u793a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"Copy prettyprint lang-js\"><code>\u300c!\u300d \uff0b Enter\u3067\u7d42\u4e86\r\n\u3053\u306e\u5f8c\u306b\u5165\u529b &gt;\r\n\u308a\u3093\u3054\r\n\u308a\u3093\u3054\u3092\u82f1\u8a9e\u3067\u8868\u73fe\u3059\u308b\u3068\u30fb\u30fbapple\u3067\u3059\u3002\r\n\u3053\u306e\u5f8c\u306b\u5165\u529b &gt;\r\n\u3082\u3082\r\n\u3082\u3082\u3092\u82f1\u8a9e\u3067\u8868\u73fe\u3059\u308b\u3068\u30fb\u30fbpeach\u3067\u3059\u3002\r\n\u3053\u306e\u5f8c\u306b\u5165\u529b &gt;\r\n\u3059\u3044\u304b\r\n\u3059\u3044\u304b\u3092\u82f1\u8a9e\u3067\u8868\u73fe\u3059\u308b\u3068\u30fb\u30fb\u308f\u304b\u308a\u307e\u305b\u3093\u3002<\/code><\/pre>\n<p><span class=\"Text-highlight\">\u203b\u3053\u306e\u554f\u984c\u306e\u89e3\u7b54\u306f\u63b2\u8f09\u3057\u3066\u304a\u308a\u307e\u305b\u3093\u3002<span class=\"Post-link\" >Tech Fun IT\u30b9\u30af\u30fc\u30eb\u306eJava\u7814\u4fee<\/span>\u3067\u306f\u3001\u8b1b\u5e2b\u304c\u4e01\u5be7\u306b\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/span><br \/>\n<span class=\"Text-red-bold\">\u73fe\u5728Tech Fun IT\u30b9\u30af\u30fc\u30eb\u3067\u306f\u3001\u65b0\u898f\u53d7\u8b1b\u8005\u306e\u52df\u96c6\u306f\u884c\u306a\u3063\u3066\u304a\u308a\u307e\u305b\u3093\u3002<\/span>\t\t<\/p>\n<div class=\"Separator\">\n<div class=\"Separator__child\"><\/div>\n<\/div>\n<h3 class=\"Heading Title Title--m\" id=\"Bookmark-8\"><span class=\"Num\">8.<\/span>\u672c\u7ae0\u306e\u307e\u3068\u3081<\/h3>\n<ul class=\"Base-list\">\n<li class=\"Base-list__child\">\u300c\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u300d\u3068\u306f\u3001\u8907\u6570\u306e\u30c7\u30fc\u30bf\u3092\u307e\u3068\u3081\u3066\u6271\u3046\u6a5f\u80fd\u306e\u3053\u3068\u3002<\/li>\n<li class=\"Base-list__child\">\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u306f6\u3064\u306e\u4e3b\u8981\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u304c\u3042\u308a\u3001\u4ee3\u8868\u7684\u306a\u3082\u306e\u3068\u3057\u3066\u300cList\u300d\u3084\u300cMap\u300d\u3001\u300cSet\u300d\u306a\u3069\u304c\u3042\u308b\u3002<\/li>\n<li class=\"Base-list__child\">List\u306f\u3001\u9806\u5e8f\u4ed8\u3051\u3055\u308c\u305f\u72b6\u614b\u3067\u30c7\u30fc\u30bf\u3092\u4fdd\u6301\u3059\u308b\u3002<\/li>\n<li class=\"Base-list__child\">Map\u306f\u3001\u300c\u30ad\u30fc\uff08key\uff09\u300d\u3068\u300c\u5024\uff08value\uff09\u300d\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u30c7\u30fc\u30bf\u3092\u4fdd\u6301\u3059\u308b\u3002<\/li>\n<li class=\"Base-list__child\">Set\u306fList\u306b\u4f3c\u3066\u3044\u308b\u304c\u3001\u540c\u3058\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u91cd\u8907\u3057\u3066\u4fdd\u6301\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u3002<\/li>\n<\/ul>\n<p>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306f\u5b9f\u52d9\u3067\u975e\u5e38\u306b\u3088\u304f\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u7406\u89e3\u304c\u3042\u3084\u3075\u3084\u3060\u3068\u611f\u3058\u305f\u5834\u5408\u306f\u8b1b\u5e2b\u306b\u8cea\u554f\u3059\u308b\u306a\u3069\u3057\u3066\u7591\u554f\u3092\u89e3\u6d88\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u3064\u3044\u3066\u306e\u8aac\u660e\u306f\u3001\u4ee5\u4e0a\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u672c\u7ae0\u3067\u306e\u5b66\u7fd2\u9805\u76ee \u672c\u7ae0\u3067\u306f\u3001\u8907\u6570\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u307e\u3068\u3081\u3066\u4fdd\u6301\u3059\u308b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u95a2\u3057\u3066\u5b66\u7fd2\u3057\u307e\u3059\u3002 2.\u672c\u7ae0\u306e\u8b1b\u7fa9 \u672c\u7ae0\u3067\u5b66\u7fd2\u3059\u308b\u5185\u5bb9\u3092\u52d5\u753b\u3068\u3057\u3066\u307e\u3068\u3081\u305f\u3082\u306e\u3067\u3059\u3002\u6700\u521d\u306b\u4e00\u901a\u308a\u898b\u7d42\u308f\u3063\u305f\u5f8c\u3067\u3001\u5b66\u7fd2\u306b\u5165\u308b\u3088\u3046\u306b\u3057\u3066\u304f\u3060\u3055\u2026<\/p>\n","protected":false},"author":5,"featured_media":6008,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"class_list":["post-191","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java-base"],"acf":{"chapter":13,"javabase_order":15,"list-display_description":"\u8907\u6570\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u307e\u3068\u3081\u3066\u4fdd\u6301\u3059\u308b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u95a2\u3057\u3066\u5b66\u7fd2\u3057\u307e\u3059\u3002"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/posts\/191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/comments?post=191"}],"version-history":[{"count":24,"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/posts\/191\/revisions"}],"predecessor-version":[{"id":6501,"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/posts\/191\/revisions\/6501"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/media\/6008"}],"wp:attachment":[{"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/media?parent=191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techfun.cc\/wp-json\/wp\/v2\/categories?post=191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}