<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>緊急脱出用ロケット椅子</title>
<link>https://ameblo.jp/restpal/</link>
<atom:link href="https://rssblog.ameba.jp/restpal/rss20.xml" rel="self" type="application/rss+xml" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
<description>小学校のとき、生徒全員が欲しいものを書いた自分が書いたのは「緊急脱出用ロケット椅子」困ったときにボタンを押すと上空遥か彼方へ飛んで行ける夢のアイテム未だ世の中にそれは存在しない仕方ない。勉強するか・・・</description>
<language>ja</language>
<item>
<title>【Java】ジェネリックス クラス</title>
<description>
<![CDATA[ <div>//ジェネリックス使用ありの場合<br>public class GenClsTest&lt;T&gt; {<br>&nbsp;<br>&nbsp; &nbsp; //フィールド<br>&nbsp; &nbsp; private T value;<br>&nbsp;<br>&nbsp; &nbsp; //コンストラクタ<br>&nbsp; &nbsp; public GenClsTest(T arg) {<br>&nbsp; &nbsp; &nbsp; &nbsp; this.value = arg;<br>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; //セッター<br>&nbsp; &nbsp; public void setValue(T arg) {<br>&nbsp; &nbsp; &nbsp; &nbsp; this.value = arg;<br>&nbsp; &nbsp; }<br>&nbsp;<br>&nbsp; &nbsp; //ゲッター<br>&nbsp; &nbsp; public T getValue() {<br>&nbsp; &nbsp; &nbsp; &nbsp; return this.value;<br>&nbsp; &nbsp; }<br>&nbsp;<br>&nbsp; &nbsp; //メインメソッド<br>&nbsp; &nbsp; public static void main(String[]args) {</div><div><br>&nbsp; &nbsp; &nbsp; &nbsp; //GenStrインスタンス生成、コンストラクタでフィールド変数にダッフィーをセット<br>&nbsp; &nbsp; &nbsp; &nbsp; GenClsTest&lt;String&gt; GenStr = new GenClsTest&lt;&gt;("ダッフィー");<br>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(GenStr.getValue());<br>&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; //フィールド変数にシェリーメイをセット<br>&nbsp; &nbsp; &nbsp; &nbsp; GenStr.setValue("シェリーメイね");<br>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(GenStr.getValue());</div><div>&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println();<br>&nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; //GenIntインスタンス生成、コンストラクタでフィールド変数に100をセット<br>&nbsp; &nbsp; &nbsp; &nbsp; GenClsTest&lt;Integer&gt; GenInt = new GenClsTest&lt;&gt;(100);<br>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(GenInt.getValue());<br>&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; //フィールド変数に1000をセット<br>&nbsp; &nbsp; &nbsp; &nbsp; GenInt.setValue(1000);<br>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(GenInt.getValue());<br>&nbsp; &nbsp; }<br>}</div><div>&nbsp;</div><div>■実行結果</div><div><div>ダッフィー<br>シェリーメイね</div><div>&nbsp;</div><div>100<br>1000</div><div>&nbsp;</div><div><div>//ジェネリックス使用なし Stringの場合<br>public class GenClsTest {<br>&nbsp;<br>&nbsp; &nbsp; //フィールド<br>&nbsp; &nbsp; private String value;<br>&nbsp;<br>&nbsp; &nbsp; //コンストラクタ<br>&nbsp; &nbsp; public GenClsTest(String arg) {<br>&nbsp; &nbsp; &nbsp; &nbsp; this.value = arg;<br>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; //セッター<br>&nbsp; &nbsp; public void setValue(String arg) {<br>&nbsp; &nbsp; &nbsp; &nbsp; this.value = arg;<br>&nbsp; &nbsp; }<br>&nbsp;<br>&nbsp; &nbsp; //ゲッター<br>&nbsp; &nbsp; public String getValue() {<br>&nbsp; &nbsp; &nbsp; &nbsp; return this.value;<br>&nbsp; &nbsp; }<br>&nbsp;<br>&nbsp; &nbsp; //メインメソッド<br>&nbsp; &nbsp; public static void main(String[]args) {<br>&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; //GenStrインスタンス生成、コンストラクタでフィールド変数にダッフィーをセット<br>&nbsp; &nbsp; &nbsp; &nbsp; GenClsTest GenStr = new GenClsTest("ダッフィー");<br>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(GenStr.getValue());<br>&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; //フィールド変数にシェリーメイをセット<br>&nbsp; &nbsp; &nbsp;&nbsp; GenStr.setValue("シェリーメイね");<br>&nbsp; &nbsp; &nbsp;&nbsp; System.out.println(GenStr.getValue());<br>&nbsp; &nbsp; }<br>}</div></div><div>&nbsp;</div></div><div>■実行結果</div><div>ダッフィー<br>シェリーメイね</div><div>&nbsp;</div><div><div>//ジェネリックス使用なし Integerの場合<br>public class GenClsTest {<br>&nbsp;<br>&nbsp; &nbsp; //フィールド<br>&nbsp; &nbsp; private Integer value;<br>&nbsp;<br>&nbsp; &nbsp; //コンストラクタ<br>&nbsp; &nbsp; public GenClsTest(Integer arg) {<br>&nbsp; &nbsp; &nbsp; &nbsp; this.value = arg;<br>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; //セッター<br>&nbsp; &nbsp; public void setValue(Integer arg) {<br>&nbsp; &nbsp; &nbsp; &nbsp; this.value = arg;<br>&nbsp; &nbsp; }<br>&nbsp;<br>&nbsp; &nbsp; //ゲッター<br>&nbsp; &nbsp; public Integer getValue() {<br>&nbsp; &nbsp; &nbsp; &nbsp; return this.value;<br>&nbsp; &nbsp; }<br>&nbsp;<br>&nbsp; &nbsp; //メインメソッド<br>&nbsp; &nbsp; public static void main(String[]args) {<br><span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; //GenIntインスタンス生成、コンストラクタでフィールド変数に100をセット</span></div><div>&nbsp; &nbsp; &nbsp; &nbsp; GenClsTest GenInt = new GenClsTest(100);<br>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(GenInt.getValue());</div><div><br>&nbsp; &nbsp; &nbsp; &nbsp; //フィールド変数に1000をセット<br>&nbsp; &nbsp; &nbsp; &nbsp; GenInt.setValue(1000);<br>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(GenInt.getValue());<br>&nbsp; &nbsp; }<br>}</div></div><div>&nbsp;</div><div>■実行結果</div><div>100<br>1000</div>
]]>
</description>
<link>https://ameblo.jp/restpal/entry-12508428162.html</link>
<pubDate>Sun, 18 Aug 2019 14:45:53 +0900</pubDate>
</item>
<item>
<title>【Java】ジェネリックス メソッド</title>
<description>
<![CDATA[ <div>//ジェネリックス使用ありの場合<br>public class GenMtdTest {</div><div>&nbsp; &nbsp; //引数をそのまま返すメソッド<br>&nbsp; &nbsp;&nbsp; public &lt;T&gt; T test(T arg) {<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; return arg;<br>&nbsp; &nbsp;&nbsp; }<br>&nbsp;<br>&nbsp; &nbsp; //メインメソッド<br>&nbsp; &nbsp; public static void main(String[] args) {<br>&nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; //インスタンス生成<br>&nbsp; &nbsp; &nbsp; &nbsp; GenMtdTest GenMtd = new GenMtdTest();</div><div>&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; //引数にString型の値をセットしてtestメソッドを実行<br>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(GenMtd.test("ダッフィー"));</div><div>&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; //引数にint型の値をセットしてtestメソッドを実行<br>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(GenMtd.test(100));<br>&nbsp; &nbsp; }<br>}</div><div>&nbsp;</div><div>■実行結果</div><div>ダッフィー<br>100</div><div>&nbsp;</div><div>//ジェネリックス使用なし Stringの場合<br>public class GenMtdTest {<br>&nbsp;<br>&nbsp; &nbsp; //引数をそのまま返すメソッド<br>&nbsp; &nbsp; public String test(String arg) {<br>&nbsp; &nbsp; &nbsp; &nbsp; return arg;<br>&nbsp; &nbsp;&nbsp; }<br>&nbsp;&nbsp;<br>&nbsp; &nbsp; //メインメソッド<br>&nbsp; &nbsp; public static void main(String[] args) {<br>&nbsp;&nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; //インスタンス生成<br>&nbsp; &nbsp; &nbsp; &nbsp; GenMtdTest GenMtd = new GenMtdTest();<br>&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; //引数にString型の値をセットしてtestメソッドを実行<br>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(GenMtd.test("ダッフィー"));<br>&nbsp; &nbsp; }<br>}</div><div>&nbsp;</div><div>■実行結果</div><div>ダッフィー</div><div>&nbsp;</div><div>//ジェネリックス使用なし Integerの場合<br>public class GenMtdTest {</div><div>&nbsp; &nbsp; //引数をそのまま返すメソッド<br>&nbsp; &nbsp; public Integer test(Integer arg) {<br>&nbsp; &nbsp; &nbsp; &nbsp; return arg;<br>&nbsp; &nbsp; }<br>&nbsp;<br>&nbsp; &nbsp; //メインメソッド<br>&nbsp; &nbsp; public static void main(String[] args) {<br>&nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; //インスタンス生成<br>&nbsp; &nbsp; &nbsp; &nbsp; GenMtdTest GenMtd = new GenMtdTest();<br>&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; //引数にInteger型の値をセットしてtestメソッドを実行<br>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(GenMtd.test(100));<br>&nbsp; &nbsp; }<br>}</div><div>&nbsp;</div><div>実行結果</div><div>100</div>
]]>
</description>
<link>https://ameblo.jp/restpal/entry-12508422605.html</link>
<pubDate>Sun, 18 Aug 2019 14:36:44 +0900</pubDate>
</item>
<item>
<title>【Java】コレクション Map</title>
<description>
<![CDATA[ <div>import java.util.HashMap;<br>import java.util.Iterator;</div><div>&nbsp;</div><div>public class MapTest {</div><div>&nbsp; &nbsp; public static void main(String[] args) {<br>&nbsp;&nbsp;<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>//Key=String型、Value=String型のmapに値をセット<br><span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; </span>&nbsp; &nbsp; &nbsp; HashMap&lt;String,String&gt; map = new HashMap&lt;&gt;();<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>map.put("ネズミ", "ミッキー");<br>&nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> &nbsp; &nbsp; &nbsp;</span> map.put("パンダ", "ダッフィー");<br>&nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> &nbsp; &nbsp; &nbsp;</span> map.put("イヌ", "グーフィー");<br>&nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> &nbsp; &nbsp; &nbsp;</span> map.put("ネコ", "ルシファー");<br>&nbsp;&nbsp;<br>&nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> &nbsp;</span> &nbsp; &nbsp; //mapからルシファーを削除<br>&nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> &nbsp;</span> &nbsp; &nbsp; map.remove("ネコ");<br>&nbsp;&nbsp;<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>//mapにKey=パンダが存在するか確認<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>System.out.println("パンダ:" + map.containsKey("パンダ"));<br>&nbsp;&nbsp;<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>//mapにvalue=ルシファーが存在するか確認<br>&nbsp; &nbsp; &nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; </span>System.out.println("ルシファー:" + map.containsValue("ルシファー"));<br>&nbsp;&nbsp;<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>//mapの要素数を出力<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>System.out.println("mapの要素数:" + map.size());<br>&nbsp;&nbsp;<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>//拡張for文でmapを出力<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>for(String key : map.keySet()) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> &nbsp; </span>System.out.print(key + ":" + map.get(key) + "　");<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>}<br>&nbsp;&nbsp;<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>System.out.println();<br>&nbsp;&nbsp;<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>//Iteratorでmapを出力<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>Iterator&lt;String&gt; iter = map.keySet().iterator();<br>&nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> &nbsp;</span> &nbsp; &nbsp; while(iter.hasNext()) {<br>&nbsp; &nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> &nbsp; &nbsp; &nbsp; &nbsp; </span>String key = iter.next();<br>&nbsp; &nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> &nbsp; &nbsp; &nbsp; &nbsp; </span>System.out.print(key +&nbsp; ":" + map.get(key) + "　");<br>&nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;}</div><div>&nbsp; &nbsp; }<br>}</div><div>&nbsp;</div><div>■実行結果</div><div>パンダ:true<br>ルシファー:false<br>mapの要素数:3<br>パンダ:ダッフィー　イヌ:グーフィー　ネズミ:ミッキー　<br>パンダ:ダッフィー　イヌ:グーフィー　ネズミ:ミッキー　</div>
]]>
</description>
<link>https://ameblo.jp/restpal/entry-12508420069.html</link>
<pubDate>Sun, 18 Aug 2019 14:29:31 +0900</pubDate>
</item>
<item>
<title>【Java】コレクション ArrayList</title>
<description>
<![CDATA[ <div>import java.util.ArrayList;<br>import java.util.Iterator;</div><div>&nbsp;</div><div>public class ArrayListTest {</div><div>&nbsp; &nbsp; public static void main(String[] args) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; //Integer型のArrayListに値をセット<br>&nbsp; &nbsp; &nbsp; &nbsp; ArrayList&lt;Integer&gt; list = new ArrayList&lt;&gt;();<br>&nbsp; &nbsp; &nbsp; &nbsp; int i1 = 1;<br>&nbsp; &nbsp; &nbsp; &nbsp; int i2 = 2;<br>&nbsp; &nbsp; &nbsp; &nbsp; int i3 = 3;<br>&nbsp; &nbsp; &nbsp; &nbsp; list.add(i1);<br>&nbsp; &nbsp; &nbsp; &nbsp; list.add(i2);<br>&nbsp; &nbsp; &nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; </span>list.add(i3);<br>&nbsp; &nbsp; &nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; </span>//listの先頭に0を追加(123の前に0を追加)<br>&nbsp; &nbsp; &nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; </span>list.add(0,0);</div><div>&nbsp; &nbsp; &nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; </span>//listの要素数を出力<br>&nbsp; &nbsp; &nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; </span>System.out.println("listの要素数:" + list.size());<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp; &nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; </span>&nbsp; //for文でlistを出力<br>&nbsp;&nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp;&nbsp;&nbsp; &nbsp; </span>for(int i = 0; i &lt; list.size(); i++) {<br>&nbsp; &nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> &nbsp; &nbsp; &nbsp; &nbsp; </span>System.out.print(list.get(i) + " ");<br>&nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp;&nbsp;&nbsp; </span>&nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; </span>}<br>&nbsp;&nbsp;<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>System.out.println();<br>&nbsp;&nbsp;<br>&nbsp; &nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; </span>//拡張for文でlistを出力<br>&nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> &nbsp; &nbsp; &nbsp;</span> for(int i : list){<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>&nbsp; &nbsp; System.out.print(i + " ");<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>}<br>&nbsp;&nbsp;<br>&nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> &nbsp; &nbsp; &nbsp;</span> System.out.println();<br>&nbsp;&nbsp;<br>&nbsp; &nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; </span>//Iteratorでlistを出力<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>Iterator&lt;Integer&gt; iter = list.iterator();<br>&nbsp;<span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> &nbsp; &nbsp;</span> &nbsp; while(iter.hasNext()) {<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>&nbsp; &nbsp; System.out.print(iter.next() + " ");<br>&nbsp; <span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; &nbsp; </span>}<br><span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">&nbsp; &nbsp; </span>}<br>}</div><div>&nbsp;</div><div>■実行結果</div><div>listの要素数:4<br>0 1 2 3<br>0 1 2 3<br>0 1 2 3</div>
]]>
</description>
<link>https://ameblo.jp/restpal/entry-12508417138.html</link>
<pubDate>Sun, 18 Aug 2019 14:21:38 +0900</pubDate>
</item>
<item>
<title>【日常】その日のストレスはその日に解消</title>
<description>
<![CDATA[ <p>自分のストレス解消法をご紹介</p><p>&nbsp;</p><p><span style="font-style:italic;"><span style="font-weight:bold;">寝る前に30分、真空管アンプで好きな音楽を聴く</span></span></p><p>&nbsp;</p><p><a href="https://stat.ameba.jp/user_images/20190630/17/restpal/66/a2/j/o3840216014486671193.jpg"><img alt="" height="236" src="https://stat.ameba.jp/user_images/20190630/17/restpal/66/a2/j/o3840216014486671193.jpg" width="420"></a></p><p>&nbsp;</p><p><span style="font-weight:bold;">写真の機材</span></p><ul><li><span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">真空管アンプ(中央)：TUBE-01J</span></li><li><span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">オーディオプレイヤー(右)：Fiio X3</span></li><li><span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">ヘッドホン(左)：A2000Z</span></li></ul><p><span style="font-weight:bold;">接続方法</span></p><p>&nbsp;</p><p>　デジタルオーディオプレイヤー</p><p>　　↓</p><p>　真空管アンプ</p><p><span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">　　↓</span></p><p>　ヘッドホン</p><p>&nbsp;</p><p><span style="font-weight:bold;">使用方法</span></p><ul><li>真空管アンプの電源を入れる</li><li>オーディオプレイヤー再生</li><li>布団にもぐりヘッドホン装着</li><li><span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: inherit; font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">リモコンで</span>シーリングライトを消す</li><li>聴き終わったら真空管アンプの電源を切る</li></ul><p><span style="font-weight:bold;">球転がし</span></p><ul><li><span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">飛び出てる2本の真空管は、引っこ抜けます</span></li><li>真空管ごとにわずかに音が違います</li><li>真空管を替えて音の違いを楽しむことを<span style="color:#ff0000;"><span style="font-weight:bold;">球転がし</span></span>といいます</li><li>写真の黄色の真空管は、アメリカのWE403Bです</li><li>他にもロシアや中国や日本の真空管を持っています</li><li>東芝は音がはっきりしすぎて固かったりロシアは残響が多かったり</li></ul><p>&nbsp;</p><p><a href="https://stat.ameba.jp/user_images/20190630/17/restpal/60/94/j/o3840216014486671382.jpg"><img alt="" height="236" src="https://stat.ameba.jp/user_images/20190630/17/restpal/60/94/j/o3840216014486671382.jpg" width="420"></a></p><p>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/restpal/entry-12488336053.html</link>
<pubDate>Sun, 30 Jun 2019 18:02:47 +0900</pubDate>
</item>
<item>
<title>ゴールド取得</title>
<description>
<![CDATA[ <p>車のゴールド免許でなく Java SE8 Gold の方</p><p>難易度は車のゴールド免許の方がはるかに高い</p><p>&nbsp;</p><p>完全に一時停止してなかった とか</p><p>渋滞の交差点でいけるだけ行くところで信号無視とられたり とか</p><p><span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">納車当日にVtecを試してスピード違反で免停とか</span></p><p>&nbsp;</p><p>警察の人には何度もお世話になった</p><p><span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">取り調べ室でのこと</span></p><p>何してたんだ？</p><p>夜中にラーメン屋めぐりしてました</p><p><span style="display: inline !important; float: none; background-color: rgb(255, 255, 255); color: rgb(68, 68, 68); font-family: &quot;ヒラギノ角ゴ Pro W3&quot;,&quot;Hiragino Kaku Gothic Pro&quot;,&quot;ＭＳ Ｐゴシック&quot;,&quot;MS PGothic&quot;,sans-serif,&quot;メイリオ&quot;,Meiryo; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">どこのラーメン屋だ？</span></p><p>吉川に美味しい味噌ラーメン屋があってそこです</p><p>実は俺、元吉川の交番勤務だったんだが、あの店は美味いよな！</p><p>&nbsp;</p><p>今思えば、あの会話こそが「アイスブレーク」と呼ばれる</p><p>本題に入る前に場を和ませるための雑談だったんだな</p><p>&nbsp;</p><p>Java SE8 Goldのキーポイント</p><p>&nbsp;</p><p>Stream生成・・・調理場に食材を用意する</p><p>中間操作・・・食材を調理する(皮むき、焼く、煮るなど)</p><p>ラムダ式・・・万能調理機器(食材とセットすると調理結果を返すようプログラム)</p><p>終端操作・・・料理を皿にもって出す</p><p>&nbsp;</p><p>芸事は何事も反復練習(人類最速ラップ芸者 モツMCの言葉)</p><p>黒本の例題をすべてEclipseで手打ち</p><p>黒本の正誤表に載っていない間違いを発見したりしつつ打ち込む</p><p>土日は一日中打ち込んでは実行の繰り返し</p><p>&nbsp;</p><p>合格後の自分へのご褒美</p><p>&nbsp;</p><p>かぐや様は告らせたい を一気に観る！</p><p>&nbsp; 「お可愛いこと・・・」がたまらない</p>
]]>
</description>
<link>https://ameblo.jp/restpal/entry-12442203158.html</link>
<pubDate>Sat, 23 Feb 2019 12:38:08 +0900</pubDate>
</item>
<item>
<title>【Java】メモ1</title>
<description>
<![CDATA[ <p>■switch文</p><p>指定可能な定数　byte,char,short,int,integer,enum,String</p><p>&nbsp;</p><p>■整数リテラル</p><p>2進数　先頭0b</p><p>8進数　先頭0</p><p>16進数　先頭0x</p><p>アンダースコア　カンマの代わり　先頭末尾に使用不可</p><p>&nbsp;</p><p>■アクセス修飾子</p><p>public,protected,private</p><p>protected,privateはクラス宣言時に使用不可</p><p>アクセス修飾子はローカル変数に使用不可</p><p>publicクラスは1ソースファイルに1つ クラス名=ソースファイル名</p><p>&nbsp;</p><p>■イミュータブルオブジェクト</p><p>インスタンス化から属性を変更させない</p><p>クラス、フィールド、メソッドをfinal指定</p><p>オブジェクトの状態を変更するメソッドを定義しない</p><p>getterで参照型オブジェクトを返すとアドレスがバレるので別オブジェクトを作って返す</p><p>&nbsp;</p><p>■final修飾子</p><p>クラス　サブクラス作成不可</p><p>メソッド　サブクラスでオーバーライド不可</p><p>変数　定数になる</p><p>&nbsp;</p><p>■static修飾子</p><p>フィールド、メソッドに指定　クラス名.変数名、クラス名.メソッド名で呼び出し</p><p>インスタンス化しなくても使用可能</p><p>staticメソッドをサブクラスの非staticメソッドでオーバーライド不可</p><p>staticメンバから非staticメンバへのアクセスは非staticメンバがインスタンス化されていないとできない</p><p>&nbsp;</p><p>■staticイニシャライザブロック</p><p>static { }　クラスファイルがロードされるとき1度だけ実行</p><p>コンパイラが全コンストラクタにstaticイニシャライザブロックをコピーするので</p><p>コンストラクタの代わりにstaticイニシャライザブロックで初期化可能</p><p>インスタンス共通の処理に使える</p><p>&nbsp;</p><p>■シングルトンパターン</p><p>システムでオブジェクトを1つしか作らないよう制限する</p><p>オブジェクトをprivate static finalにする</p><p>コンストラクタをprivateにする</p><p>publicでオブジェクトを返すメソッドを用意</p><p>&nbsp;</p><p>■enum;</p><p>enum kuma&nbsp;{パンダ,ダッフィー,シェリーメイ}</p><p>コンパイルするとクラスファイルが作られる　kuma.class</p><p>インスタンス化不可</p><p>final class kuma extends java.lang.Enum&lt;kuma&gt;{</p><p>&nbsp; public static final kuma パンダ;</p><p>&nbsp; public static final kuma ダッフィー;</p><p>&nbsp; public static final kuma シェリーメイ;</p><p>&nbsp; public static kuma[] values(){}　定数を配列で返す</p><p>&nbsp; public static kuma valueOf(java.lang.String){}　引数で指定した名前の定数を返す</p><p>}</p><p>kuma.パンダ.ordinal();　0　列挙順を返す</p><p>Comparableインターフェースで列挙順を管理</p><p>抽象メソッドを宣言して列挙値をオーバーライド可能</p><p>&nbsp;</p><p>■Objectクラス</p><p>java.lang.Object　ルートクラス</p><p>extendsを使わず定義したクラスはObjectクラスを継承</p><p>getClass()　実行時クラスを返す</p><p>hashCode()　ハッシュコードを返す　hashCodeはjava実行環境がオブジェクトを識別</p><p>finalize()　オブジェクトへの参照がない場合ガベージコレクタが呼び出す</p><p>toString()　クラス名@ハッシュコードを返す</p><p>　StringクラスはtoString()をオーバーライドしオブジェクトが保持する文字列を返す</p><p>equals(Object ojb)　同一オブジェクトならtrue　==演算子と同じ</p><p>　オブジェクトの参照は違っても保持する値が同じなら同一としたい場合は、</p><p>　equalsメソッドをオーバーライドして値が同じならtrueを返す</p><p>　instanceOf演算子でオブジェクトが同じクラスかを確認後、変数の値が同じか確認</p><p>　同一クラスでなくても右辺がスーパークラス、インターフェースで、左辺がサブクラスであればOK</p><p>&nbsp;</p><p>■staticインポート</p><p>クラス名を指定せずにstatic変数、staticメソッドにアクセスする機能</p><p>事前にimportして使う</p><p>import static パッケージ名.クラス名.static変数名 or　staticメソッド名</p>
]]>
</description>
<link>https://ameblo.jp/restpal/entry-12392258082.html</link>
<pubDate>Sat, 21 Jul 2018 09:49:55 +0900</pubDate>
</item>
<item>
<title>【Java】代入演算子とインクリメント</title>
<description>
<![CDATA[ <p><span style="font-weight:bold;">代入演算子</span></p><p>&nbsp;</p><p>代入演算子は、値を変数に入れるための演算子</p><p>= 、 += 、&nbsp;-= 、&nbsp;*= 、&nbsp;/=</p><p>&nbsp;</p><p>使用例</p><p>変数aに100を入れる</p><p>&nbsp;a = 100;</p><p>&nbsp;</p><p>変数aに100を足す</p><p>&nbsp;a = 100;</p><p>&nbsp;a += 100;　(a = a + 100;と同じ)</p><p>&nbsp;System.out.println(a);　&nbsp;//実行結果：200</p><p>　</p><p>変数aから100を引く</p><p>&nbsp;a = 100;</p><p>&nbsp;a -= 100;　(a = a - 100;と同じ)</p><p>&nbsp;System.out.println(a); 　//実行結果：0</p><p>&nbsp;</p><p>変数aに100を掛る</p><p>&nbsp;a = 100;</p><p>&nbsp;a *= 100;　(a = a * 100;と同じ)</p><p>&nbsp;System.out.println(a); 　//実行結果：10000</p><p>&nbsp;</p><p>変数aを100で割る</p><p>&nbsp;a = 100;</p><p>&nbsp;a /= 100;　　(a = a / 100;と同じ)</p><p>&nbsp;System.out.println(a); 　//実行結果：1</p><p>&nbsp;</p><p><span style="font-weight:bold;">インクリメント</span></p><p>&nbsp;</p><p>インクリメントは前置インクリメントと後置インクリメントの2種類がある</p><p>&nbsp;</p><p>前置インクリメント・・・演算前に変数を+1する</p><p>&nbsp;a = 100;</p><p>&nbsp;b =&nbsp; ++a;　//aを+1してからbに入れる</p><p>&nbsp;System.out.println(a); 　//実行結果：101</p><p>&nbsp;System.out.println(b); 　//実行結果：101</p><p>&nbsp;</p><p>後置インクリメント・・・演算後に変数を+1する</p><p>&nbsp;a = 100;</p><p>&nbsp;b =&nbsp; a++;　//aをbに入れてから、aを+1する</p><p>&nbsp;System.out.println(a); 　//実行結果：101</p><p>&nbsp;System.out.println(b); 　//実行結果：100</p><p>&nbsp;</p><p>for文は後置インクリメント</p><p>iが10より小さいか判定してから、iを+1する</p><p>&nbsp;for (int i=0; i&lt;10; i++) {</p><p>&nbsp; &nbsp; &nbsp; //処理</p><p>&nbsp; }</p><p>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/restpal/entry-12378207127.html</link>
<pubDate>Wed, 23 May 2018 21:59:17 +0900</pubDate>
</item>
<item>
<title>【Java】配列とfor文</title>
<description>
<![CDATA[ <p>配列は複数の値を1つにまとめて扱うためのクラス</p><p>&nbsp;</p><p>配列を扱うには、</p><p>　・配列を宣言する</p><p>　・配列の要素に値をセットする</p><p>　・配列の要素を参照する</p><p>&nbsp;</p><p><span style="font-weight:bold;">配列の宣言</span></p><p>　配列宣言時に配列クラスをインスタンス化</p><p>　配列宣言時に扱う要素数を決定</p><p>&nbsp;</p><p>　2つの文字列を扱う配列の宣言</p><p>　String[] array = new String[2];</p><p>&nbsp;</p><p>　String[]・・・配列の型(int型の場合はint[])</p><p>　array・・・配列の名前(何でもいい)</p><p>　new・・・インスタンス化</p><p>　String[2];・・・型と扱う要素数(intの場合はint[2])</p><p>　[2]は要素数。10個の文字列を扱う場合は[10]</p><p>&nbsp;</p><p><span style="font-weight:bold;">配列の要素に値をセット</span></p><p>&nbsp;&nbsp;array[0] = "reckful";<br>&nbsp; array[1] = "pikaboo";&nbsp;<br>　配列の先頭の要素番号は0</p><p>　配列の最後の要素番号は宣言した要素数-1</p><p>　宣言時にString[2]とした場合の最後の要素番号は、2-1の1</p><p>　文字列型の配列には文字列しかセットできない</p><p>&nbsp;</p><p>以下は文字列型の配列に2つの名前をセット</p><p>■コード</p><p>public class Test {<br>&nbsp;&nbsp; &nbsp;public static void main(String[] args) {<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;String[] array = new String[2];<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;array[0] = "reckful";<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;array[1] = "pikaboo";&nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;System.out.println(array[0]);<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;System.out.println(array[1]);<br>&nbsp;&nbsp; &nbsp;}<br>}</p><p>&nbsp;</p><p>■実行結果</p><p>reckful<br>pikaboo</p><p>&nbsp;</p><p><span style="font-weight:bold;">for文で配列の要素を参照する</span></p><p>&nbsp;</p><p>for文は回数を指定して処理を繰り返す構文</p><p>for (初期化; 条件; 更新) {</p><p>&nbsp; &nbsp; //処理</p><p>}</p><p>&nbsp;</p><p>処理を10回繰り返す場合のfor文</p><p>iが10より小さい間(0～9まで)の10回繰り返す</p><p>for (int i=0; i&lt;10; i++) {</p><p>&nbsp; &nbsp; //処理</p><p>}</p><p>&nbsp;</p><p>配列の要素数繰り返すfor文</p><p>for (int i=0; i&lt;array.length; i++) {</p><p>&nbsp; &nbsp; //処理</p><p>}</p><p>array.lengthは、配列宣言時の要素数(String[2]の場合は2)</p><p>以下はiが2より小さい間繰り返す(iが0と1のとき処理を実行)</p><p>&nbsp;</p><p>■コード</p><p>public class Test {<br>&nbsp;&nbsp; &nbsp;public static void main(String[] args) {<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;String[] array = new String[2];<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;array[0] = "reckful";<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;array[1] = "pikaboo";&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; for (int i=0; i&lt;array.length; i++) {<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;System.out.println(array[i]);&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br>&nbsp;&nbsp; &nbsp;}<br>}</p><p>&nbsp;</p><p>■実行結果</p><p>reckful<br>pikaboo<br>&nbsp;</p><p><span style="font-weight:bold;">拡張for文で配列の要素を参照する</span></p><p>&nbsp;</p><p>拡張for文は単純に配列の先頭から最後まで順番に要素を参照する</p><p>構文がシンプルなので単純な繰り返し処理に使う</p><p>&nbsp; &nbsp; &nbsp; &nbsp; for (String tmp : array) {<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;System.out.println(tmp);<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}</p><p>String tmp・・・配列の要素をセットする変数</p><p>変数の型は配列の型と合わせる</p><p>int型の配列の要素をセットする場合はint tmp</p><p>array・・・配列名</p><p>&nbsp;</p><p>■コード</p><p>public class Test {<br>&nbsp;&nbsp; &nbsp;public static void main(String[] args) {<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;String[] array = new String[2];<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;array[0] = "reckful";<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;array[1] = "pikaboo";&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; for (String tmp : array) {<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;System.out.println(tmp);<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br>&nbsp;&nbsp; &nbsp;}<br>}</p><p>&nbsp;</p><p>■実行結果</p><p>reckful<br>pikaboo</p>
]]>
</description>
<link>https://ameblo.jp/restpal/entry-12377444222.html</link>
<pubDate>Sun, 20 May 2018 21:08:11 +0900</pubDate>
</item>
<item>
<title>【Java】アクセス修飾子</title>
<description>
<![CDATA[ <p>アクセス修飾子は、他クラスから自クラスへのアクセスを制御するもの</p><p>&nbsp;</p><p>アクセス修飾子の種類</p><p>・public・・・全クラスで使えるようにする</p><p>・protected・・・同一パッケージに属する または サブクラスのみで使えるようにする</p><p>・private・・・クラス内のみで使えるようにする</p><p>・指定なし・・・同一パッケージに属するクラスのみで使えるようにする</p><p>&nbsp;</p><p>アクセス修飾子の基本的な付与</p><p>・フィールド</p><p>　privateを付与</p><p>　隠蔽せず公開する場合はpublicを付与</p><p>&nbsp;</p><p>・メソッド</p><p>　他クラスで使う場合はpublicを付与</p><p>　他クラスで使わない場合はprivateを付与</p><p>&nbsp;</p><p>・クラス宣言</p><p>　publicを付与</p><p>　クラス宣言に付与できるのはpublicと指定なし</p><p>　クラスは公開して使うのでprivateはない</p><p>　基本は1ソースファイルに1クラスを書くが複数クラスを書ける</p><p>　publicを付与したクラス名とソースファイル名が異なるとコンパイルエラー</p><p>　1ソースファイルに複数クラスを書く場合は注意</p><p><br>・コンストラクタ</p><p>　publicを付与</p><p>　基本は他クラスからクラスのインスタンス化で使うのでpublic</p><p>　staticフィールド、メソッドのみのクラスを作る場合に</p><p>　インスタンス化抑止でコンストラクタにprivateを付与することあり</p><p>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/restpal/entry-12377335637.html</link>
<pubDate>Sun, 20 May 2018 12:22:26 +0900</pubDate>
</item>
</channel>
</rss>
