<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://www.typea.info/tips_/index.php?action=history&amp;feed=atom&amp;title=Effective_Java</id>
	<title>Effective Java - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://www.typea.info/tips_/index.php?action=history&amp;feed=atom&amp;title=Effective_Java"/>
	<link rel="alternate" type="text/html" href="https://www.typea.info/tips_/index.php?title=Effective_Java&amp;action=history"/>
	<updated>2026-04-25T07:10:22Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>https://www.typea.info/tips_/index.php?title=Effective_Java&amp;diff=5970&amp;oldid=prev</id>
		<title>2020年2月16日 (日) 04:24にPirotoによる</title>
		<link rel="alternate" type="text/html" href="https://www.typea.info/tips_/index.php?title=Effective_Java&amp;diff=5970&amp;oldid=prev"/>
		<updated>2020-02-16T04:24:58Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2020年2月16日 (日) 04:24時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;1行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;1行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Effective Java==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[&lt;/ins&gt;Effective Java&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]]&lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Java]] |  &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Java]] |  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;[&lt;/del&gt;[http://www.amazon.co.jp/gp/product/489471499X?ie=UTF8&amp;amp;tag=typea09-22&amp;amp;linkCode=as2&amp;amp;camp=247&amp;amp;creative=7399&amp;amp;creativeASIN=489471499X Effective Java 第2版]&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;] |  &lt;/del&gt;から、メモ&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[http://www.amazon.co.jp/gp/product/489471499X?ie=UTF8&amp;amp;tag=typea09-22&amp;amp;linkCode=as2&amp;amp;camp=247&amp;amp;creative=7399&amp;amp;creativeASIN=489471499X Effective Java 第2版] から、メモ&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{amazon|489471499X}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{amazon|489471499X}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l137&quot; &gt;137行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;137行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  }&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;amp;lt;blockquote&amp;amp;gt;Eclipse でオブジェクトのコンテキストメニュー - Source - Generate hashCode() and equals() で自動生成出来る&amp;amp;lt;/blockquote&amp;amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;amp;lt;blockquote&amp;amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[&lt;/ins&gt;Eclipse&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]] &lt;/ins&gt;でオブジェクトのコンテキストメニュー - Source - Generate hashCode() and equals() で自動生成出来る&amp;amp;lt;/blockquote&amp;amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===toString()を常にオーバーライドする===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===toString()を常にオーバーライドする===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*優れたtoString()を実装するとクラスが使いやすくなる&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*優れたtoString()を実装するとクラスが使いやすくなる&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l208&quot; &gt;208行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;208行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*クラス階層の面白みのない模倣に過ぎない&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*クラス階層の面白みのない模倣に過ぎない&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  class Figure {&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  class Figure {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    enum Shape = { &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;RECTANGLE&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;CIRCLE &lt;/del&gt;};&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    enum Shape = { &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[R]]ECTANGLE&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;CI[[R]]CLE &lt;/ins&gt;};&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    final Shape shape;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;    final Shape shape;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          :&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          :&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Piroto</name></author>
		
	</entry>
	<entry>
		<id>https://www.typea.info/tips_/index.php?title=Effective_Java&amp;diff=4874&amp;oldid=prev</id>
		<title>2020年2月15日 (土) 08:35にPirotoによる</title>
		<link rel="alternate" type="text/html" href="https://www.typea.info/tips_/index.php?title=Effective_Java&amp;diff=4874&amp;oldid=prev"/>
		<updated>2020-02-15T08:35:15Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2020年2月15日 (土) 08:35時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;1行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;1行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Effective Java==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Effective Java==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Java]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Java]] &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;| &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[http://www.amazon.co.jp/gp/product/489471499X?ie=UTF8&amp;amp;tag=typea09-22&amp;amp;linkCode=as2&amp;amp;camp=247&amp;amp;creative=7399&amp;amp;creativeASIN=489471499X Effective Java 第2版]] から、メモ&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[http://www.amazon.co.jp/gp/product/489471499X?ie=UTF8&amp;amp;tag=typea09-22&amp;amp;linkCode=as2&amp;amp;camp=247&amp;amp;creative=7399&amp;amp;creativeASIN=489471499X Effective Java 第2版]] &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;|  &lt;/ins&gt;から、メモ&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{amazon|489471499X}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{amazon|489471499X}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Piroto</name></author>
		
	</entry>
	<entry>
		<id>https://www.typea.info/tips_/index.php?title=Effective_Java&amp;diff=3159&amp;oldid=prev</id>
		<title>2020年2月15日 (土) 08:02にPirotoによる</title>
		<link rel="alternate" type="text/html" href="https://www.typea.info/tips_/index.php?title=Effective_Java&amp;diff=3159&amp;oldid=prev"/>
		<updated>2020-02-15T08:02:09Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2020年2月15日 (土) 08:02時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;1行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;1行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Effective Java==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Effective Java==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[Java]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[&lt;/ins&gt;[Java&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]&lt;/ins&gt;]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[http://www.amazon.co.jp/gp/product/489471499X?ie=UTF8&amp;amp;tag=typea09-22&amp;amp;linkCode=as2&amp;amp;camp=247&amp;amp;creative=7399&amp;amp;creativeASIN=489471499X Effective Java 第2版] から、メモ&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[&lt;/ins&gt;[http://www.amazon.co.jp/gp/product/489471499X?ie=UTF8&amp;amp;tag=typea09-22&amp;amp;linkCode=as2&amp;amp;camp=247&amp;amp;creative=7399&amp;amp;creativeASIN=489471499X Effective Java 第2版&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]&lt;/ins&gt;] から、メモ&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{amazon|489471499X}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{amazon|489471499X}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l116&quot; &gt;116行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;116行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;&lt;/del&gt;blockquote&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt;&lt;/del&gt;抽象化の恩恵をあきらめずに、インスタンス化可能なクラスを拡張して、equals 契約を守ったまま、値要素を追加する方法はない。&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;&lt;/del&gt;/blockquote&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;lt;&lt;/ins&gt;blockquote&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;gt;&lt;/ins&gt;抽象化の恩恵をあきらめずに、インスタンス化可能なクラスを拡張して、equals 契約を守ったまま、値要素を追加する方法はない。&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;lt;&lt;/ins&gt;/blockquote&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===equals をオーバーライドする時は、常に hashCode をオーバーライドする===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===equals をオーバーライドする時は、常に hashCode をオーバーライドする===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;====hashCode の実装例====&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;====hashCode の実装例====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l123&quot; &gt;123行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;123行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##boolean なら (f?1:0)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##boolean なら (f?1:0)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##byte,char,short,int なら、(int)f&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##byte,char,short,int なら、(int)f&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##long なら、(int)(f^(f&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt;&amp;gt;&lt;/del&gt;32))&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##long なら、(int)(f^(f&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;gt;&amp;amp;gt;&lt;/ins&gt;32))&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##float なら、Float.floatToIntBits(f)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##float なら、Float.floatToIntBits(f)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##double なら、Double.doubleToLongBits(f) を行い、long と同様の変換&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;##double なら、Double.doubleToLongBits(f) を行い、long と同様の変換&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l137&quot; &gt;137行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;137行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  }&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;&lt;/del&gt;blockquote&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt;&lt;/del&gt;Eclipse でオブジェクトのコンテキストメニュー - Source - Generate hashCode() and equals() で自動生成出来る&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;&lt;/del&gt;/blockquote&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;lt;&lt;/ins&gt;blockquote&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;gt;&lt;/ins&gt;Eclipse でオブジェクトのコンテキストメニュー - Source - Generate hashCode() and equals() で自動生成出来る&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;lt;&lt;/ins&gt;/blockquote&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===toString()を常にオーバーライドする===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===toString()を常にオーバーライドする===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*優れたtoString()を実装するとクラスが使いやすくなる&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*優れたtoString()を実装するとクラスが使いやすくなる&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l144&quot; &gt;144行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;144行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===clone を注意してオーバーライドする===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===clone を注意してオーバーライドする===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;&lt;/del&gt;blockquote&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt;&lt;/del&gt;インターフェースは Cloneable を拡張すべきではなく、継承されるように設計されたクラスでは、Cloneable を実装すべきでない&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;&lt;/del&gt;/blockquote&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;lt;&lt;/ins&gt;blockquote&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;gt;&lt;/ins&gt;インターフェースは Cloneable を拡張すべきではなく、継承されるように設計されたクラスでは、Cloneable を実装すべきでない&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;lt;&lt;/ins&gt;/blockquote&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*コピーを行う代替手段を提供するか、コピーしないほうがよい&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*コピーを行う代替手段を提供するか、コピーしないほうがよい&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*上手い方法は、コピーコンストラクタか、コピーファクトリーを提供すること。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*上手い方法は、コピーコンストラクタか、コピーファクトリーを提供すること。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l154&quot; &gt;154行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;154行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=====equals メソッドの一般契約に似た契約=====&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=====equals メソッドの一般契約に似た契約=====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*sgn(x.compareTo(y) == -sgn(y.compareTo(x)) であること&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*sgn(x.compareTo(y) == -sgn(y.compareTo(x)) であること&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*x.compareTo(y) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt; &lt;/del&gt;0 &amp;amp;&amp;amp; y.compareTo(z) は、x.compareTo(z) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt; &lt;/del&gt;0 であること&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*x.compareTo(y) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;gt; &lt;/ins&gt;0 &amp;amp;&amp;amp; y.compareTo(z) は、x.compareTo(z) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;gt; &lt;/ins&gt;0 であること&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*x.compareTo(y)＝＝ 0 が、sgn(x.compareTo(z) ＝＝ sgn(y.comareTo(z)) であること&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*x.compareTo(y)＝＝ 0 が、sgn(x.compareTo(z) ＝＝ sgn(y.comareTo(z)) であること&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*x.compareTo(y) なら、x.equals(y) であることを推奨  &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*x.compareTo(y) なら、x.equals(y) であることを推奨  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;&lt;/del&gt;blockquote&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt;&lt;/del&gt;equals と同様、オブジェクト指向の抽象化による恩恵をあきらめずに、インスタンス化可能クラスを拡張して、compareTo 契約を守ったまま、値要素を追加する方法はない。&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;&lt;/del&gt;/blockquote&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;lt;&lt;/ins&gt;blockquote&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;gt;&lt;/ins&gt;equals と同様、オブジェクト指向の抽象化による恩恵をあきらめずに、インスタンス化可能クラスを拡張して、compareTo 契約を守ったまま、値要素を追加する方法はない。&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;lt;&lt;/ins&gt;/blockquote&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==クラスとインターフェース==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==クラスとインターフェース==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===クラスとメンバーへのアクセス可能性を最小限にする===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===クラスとメンバーへのアクセス可能性を最小限にする===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Piroto</name></author>
		
	</entry>
	<entry>
		<id>https://www.typea.info/tips_/index.php?title=Effective_Java&amp;diff=1872&amp;oldid=prev</id>
		<title>Piroto: ページの作成:「==Effective Java==  [Java]  [http://www.amazon.co.jp/gp/product/489471499X?ie=UTF8&amp;tag=typea09-22&amp;linkCode=as2&amp;camp=247&amp;creative=7399&amp;creativeASIN=489471499X Effective Ja…」</title>
		<link rel="alternate" type="text/html" href="https://www.typea.info/tips_/index.php?title=Effective_Java&amp;diff=1872&amp;oldid=prev"/>
		<updated>2020-02-15T07:31:52Z</updated>

		<summary type="html">&lt;p&gt;ページの作成:「==Effective Java==  [Java]  [http://www.amazon.co.jp/gp/product/489471499X?ie=UTF8&amp;amp;tag=typea09-22&amp;amp;linkCode=as2&amp;amp;camp=247&amp;amp;creative=7399&amp;amp;creativeASIN=489471499X Effective Ja…」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Effective Java==&lt;br /&gt;
[Java]&lt;br /&gt;
[http://www.amazon.co.jp/gp/product/489471499X?ie=UTF8&amp;amp;tag=typea09-22&amp;amp;linkCode=as2&amp;amp;camp=247&amp;amp;creative=7399&amp;amp;creativeASIN=489471499X Effective Java 第2版] から、メモ&lt;br /&gt;
&lt;br /&gt;
{{amazon|489471499X}}&lt;br /&gt;
&lt;br /&gt;
===コンストラクタの代わりに static ファクトリーメソッドを検討する===&lt;br /&gt;
*staticファクトリーメソッドのほうが、publicコンストラクタより好ましいので、最初にstaticファクトリーメソッドを検討する。&lt;br /&gt;
====static ファクトリーメソッドの一般的な名前====&lt;br /&gt;
*vlueOf&lt;br /&gt;
*of&lt;br /&gt;
*getInstance&lt;br /&gt;
*newInstance&lt;br /&gt;
*getType&lt;br /&gt;
*newTyep&lt;br /&gt;
&lt;br /&gt;
===数多くのコンストラクタパラメータに直面したときにはビルダーを検討する===&lt;br /&gt;
*コンストラクタやstaticファクトリーメソッドが多くのパラメータを持つクラスを設計する際には、ビルダーパターンはよい選択。&lt;br /&gt;
====例====&lt;br /&gt;
 public class Foo {&lt;br /&gt;
   private final int a, b, c;&lt;br /&gt;
   public static class Builder {&lt;br /&gt;
     //必須&lt;br /&gt;
     private final int a;&lt;br /&gt;
     //オプション&lt;br /&gt;
     private int b = 0;&lt;br /&gt;
     private int c = 0;&lt;br /&gt;
     &lt;br /&gt;
     public Builder(int a) { this.a = a; }&lt;br /&gt;
     &lt;br /&gt;
     public Builder putB(int b) { &lt;br /&gt;
       this.b = b; return this; &lt;br /&gt;
     }&lt;br /&gt;
     public Builder putC(int c) {&lt;br /&gt;
       this.c = c; return this;&lt;br /&gt;
     }&lt;br /&gt;
     &lt;br /&gt;
     pubcli Foo build() {&lt;br /&gt;
       return new Foo(this);&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   private Foo(Builder builder) {&lt;br /&gt;
     this.a = builder.a;&lt;br /&gt;
     this.b = builder.b;&lt;br /&gt;
     this.c = builder.c;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
===private のコンストラクタか enum 型でシングルトン特性を強制する===&lt;br /&gt;
====例====&lt;br /&gt;
=====public final フィールド=====&lt;br /&gt;
 public class Foo {&lt;br /&gt;
   public static final Foo INSTANCE = new Foo();&lt;br /&gt;
   private Foo() {}&lt;br /&gt;
   public void doSomething() {...};&lt;br /&gt;
 }&lt;br /&gt;
=====static ファクトリーメソッド=====&lt;br /&gt;
 public class Foo {&lt;br /&gt;
   private static final Foo INSTANCE = new Foo();&lt;br /&gt;
   private Foo() {}&lt;br /&gt;
   public static Foo getInstance() {&lt;br /&gt;
     return INSTANCE;&lt;br /&gt;
   }&lt;br /&gt;
   public void doSomething() {...};&lt;br /&gt;
 }&lt;br /&gt;
=====単一要素を持つ enum 型=====&lt;br /&gt;
*現在(リリース1.5以降)では最善&lt;br /&gt;
 public enum Foo {&lt;br /&gt;
   INSTANCE;&lt;br /&gt;
   public void doSomething() {...};&lt;br /&gt;
 }&lt;br /&gt;
===private のコンストラクタでインスタンス化不可能を強制する===&lt;br /&gt;
*staticメソッドと static フィールドのみからなる ユーティリティクラスは、引数なしのprivate コンストラクタを宣言することで、インスタンスかを不可能にする。&lt;br /&gt;
&lt;br /&gt;
===不必要なオブジェクトの生成を避ける===&lt;br /&gt;
====再利用を行う====&lt;br /&gt;
*オブジェクトが不変(immutable)であれば常に再利用できる&lt;br /&gt;
*変更されないとわかっている可変(mutable)オブジェクトも再利用できる&lt;br /&gt;
====遅延初期化は勧められない====&lt;br /&gt;
*実装が複雑になる&lt;br /&gt;
*顕著なパフォーマンス改善が得られない&lt;br /&gt;
====アダプター====&lt;br /&gt;
*アダプターは状態を持たないので、複数インスタンスは不要&lt;br /&gt;
====ボクシング====&lt;br /&gt;
*ボクシングされた基本データ型よりも基本データ型を選ぶ&lt;br /&gt;
*意図しない自動ボクシングに注意&lt;br /&gt;
====防御的コピー====&lt;br /&gt;
*新たなオブジェクトを生成すべき場合、再利用は行わない&lt;br /&gt;
&lt;br /&gt;
===廃れたオブジェクト参照を取り除く===&lt;br /&gt;
*廃れた参照(obsolete reference)決してそれを通してオブジェクトが参照されることのない単なる参照。&lt;br /&gt;
*使い終えるとあらゆる参照にnullを設定するのは過度な対処。プログラムを不必要に乱雑にしてしまう。null設定は例外であるべき&lt;br /&gt;
*最良の方法は、参照が含まれていた変数をスコープの外に出すこと。&lt;br /&gt;
====注意====&lt;br /&gt;
===ファイナライザを避ける===&lt;br /&gt;
*ファイナライザ(finalizer)は、予測不可能で、たいていは危険であり、一般には不要。*セーフティネットとして使用(ロギングを伴い)する、ネイティブピア(ネイティブメソッドを委譲を通して利用、GCの対象外)で使用するの2つが正当な利用方法。&lt;br /&gt;
===equals をオーバーライドするときは一般契約に従う===&lt;br /&gt;
*一般契約を厳守すること&lt;br /&gt;
====一般契約====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!契約&lt;br /&gt;
!内容&lt;br /&gt;
|-&lt;br /&gt;
|反射的&lt;br /&gt;
|x.equals(x) は true&lt;br /&gt;
|-&lt;br /&gt;
|対称的&lt;br /&gt;
|y.equals(x) が true の場合のみ、x.equals(y) も true&lt;br /&gt;
|-&lt;br /&gt;
|推移的&lt;br /&gt;
|x.equals(y) 、y.equals(z) が true ならば、x.equals(z) も true &lt;br /&gt;
|-&lt;br /&gt;
|整合的&lt;br /&gt;
|情報が変更されなければ、x.equals(y) の結果は不変&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;抽象化の恩恵をあきらめずに、インスタンス化可能なクラスを拡張して、equals 契約を守ったまま、値要素を追加する方法はない。&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
===equals をオーバーライドする時は、常に hashCode をオーバーライドする===&lt;br /&gt;
====hashCode の実装例====&lt;br /&gt;
#ゼロではない定数(たとえば17)を result(int型)に保存&lt;br /&gt;
#意味のあるフィールドに対して、次を行う&lt;br /&gt;
##boolean なら (f?1:0)&lt;br /&gt;
##byte,char,short,int なら、(int)f&lt;br /&gt;
##long なら、(int)(f^(f&amp;gt;&amp;gt;32))&lt;br /&gt;
##float なら、Float.floatToIntBits(f)&lt;br /&gt;
##double なら、Double.doubleToLongBits(f) を行い、long と同様の変換&lt;br /&gt;
##参照なら、オブジェクトのhashCode() null なら 0&lt;br /&gt;
##配列なら、各要素を フィールドとして扱う&lt;br /&gt;
##result = 31 * result + c // c=計算されたハッシュコード&lt;br /&gt;
&lt;br /&gt;
 public int hashCode() {&lt;br /&gt;
   int result = 17;&lt;br /&gt;
   result = 31 * result + foo;&lt;br /&gt;
   result = 31 * result + bar;&lt;br /&gt;
   return result;  &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Eclipse でオブジェクトのコンテキストメニュー - Source - Generate hashCode() and equals() で自動生成出来る&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
===toString()を常にオーバーライドする===&lt;br /&gt;
*優れたtoString()を実装するとクラスが使いやすくなる&lt;br /&gt;
*オブジェクトに含まれる興味ある情報をすべて出力&lt;br /&gt;
*意図をドキュメントに書く&lt;br /&gt;
&lt;br /&gt;
===clone を注意してオーバーライドする===&lt;br /&gt;
&amp;lt;blockquote&amp;gt;インターフェースは Cloneable を拡張すべきではなく、継承されるように設計されたクラスでは、Cloneable を実装すべきでない&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
*コピーを行う代替手段を提供するか、コピーしないほうがよい&lt;br /&gt;
*上手い方法は、コピーコンストラクタか、コピーファクトリーを提供すること。&lt;br /&gt;
=====コピーコンストラクタ=====&lt;br /&gt;
 public Foo(Foo foo);&lt;br /&gt;
=====コピーファクトリー=====&lt;br /&gt;
 public static Foo newInstance(Foo foo);&lt;br /&gt;
===Comparable の実装を検討する===&lt;br /&gt;
=====equals メソッドの一般契約に似た契約=====&lt;br /&gt;
*sgn(x.compareTo(y) == -sgn(y.compareTo(x)) であること&lt;br /&gt;
*x.compareTo(y) &amp;gt; 0 &amp;amp;&amp;amp; y.compareTo(z) は、x.compareTo(z) &amp;gt; 0 であること&lt;br /&gt;
*x.compareTo(y)＝＝ 0 が、sgn(x.compareTo(z) ＝＝ sgn(y.comareTo(z)) であること&lt;br /&gt;
*x.compareTo(y) なら、x.equals(y) であることを推奨 &lt;br /&gt;
&amp;lt;blockquote&amp;gt;equals と同様、オブジェクト指向の抽象化による恩恵をあきらめずに、インスタンス化可能クラスを拡張して、compareTo 契約を守ったまま、値要素を追加する方法はない。&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
==クラスとインターフェース==&lt;br /&gt;
===クラスとメンバーへのアクセス可能性を最小限にする===&lt;br /&gt;
*インスタンスフィールドは決してpublic にすべきではない&lt;br /&gt;
*public の可変フィールドをクラスは、スレッドセーフではない&lt;br /&gt;
*クラスが、public static final の配列フィールドやそのようなフィールドを返すアクセサを持つのはほとんど常に誤り。&lt;br /&gt;
&lt;br /&gt;
===public のクラスでは public のフィールドではなく、アクセッサーメソッドを使う===&lt;br /&gt;
*クラスがパッケージプライベート、あるいは、private のネストしたクラスの場合、データフィールドを直接公開するのに、本質的な問題はない&lt;br /&gt;
&lt;br /&gt;
===可変性を最小限にする===&lt;br /&gt;
*不変クラスは、設計、実装、使用が可変クラスより容易、本質的にスレッドセーフ&lt;br /&gt;
====クラスを不変にする5つの規則====&lt;br /&gt;
#状態を変更するミューテイターメソッドを提供しない&lt;br /&gt;
#クラスを拡張させない(一般的にはfinalクラスとするが、別の方法もある)&lt;br /&gt;
#すべてのフィールドを final にする&lt;br /&gt;
#すべてのフィールドを private にする&lt;br /&gt;
#可変コンポーネントに対する独占的アクセスを保障&lt;br /&gt;
**可変オブジェクトを参照するフィールドを持つ場合、そのクラスのクライアントが参照を取得できないように、もしくは防御的コピーを利用する&lt;br /&gt;
&lt;br /&gt;
===継承よりコンポジションを選ぶ===&lt;br /&gt;
*インターフェースの継承は、対象外&lt;br /&gt;
====コンポジション====&lt;br /&gt;
*継承する代わりに、既存のクラスのインスタンスを参照する private フィールドを持つ*新たなクラスの各インスタンスメソッドは、保持している既存クラスの対応するインスタンスメソッドを呼び出し、結果を返す&lt;br /&gt;
*これは転送(forwarding) と呼ばれ、新たなクラスのメソッドは転送メソッド(forwarding method) と呼ばれる&lt;br /&gt;
*ラッパークラス、デコレーターパターン、としても知られる。コンポジションと転送の組み合わせを委譲(delegation) とも呼ぶ&lt;br /&gt;
&lt;br /&gt;
===継承のために設計および文書化する、でなければ継承を禁止する===&lt;br /&gt;
*クラスはオーバーライド可能なメソッド(public または protected) を呼び出すいかなる状況もドキュメントに記述しなければいけない&lt;br /&gt;
*継承のために設計されたクラスをテストする唯一の方法はサブクラスを書くこと&lt;br /&gt;
*安全にサブクラス化されるための設計と文書化がなされていないクラスのサブクラス化を禁止する。(クラスをfinalに、または、コンストラクタをprivate かパッケージプライベートにして、static ファクトリーメソッドを追加する)&lt;br /&gt;
&lt;br /&gt;
===抽象クラスよりインターフェースを選ぶ===&lt;br /&gt;
*既存のクラスを新たなインターフェースを実装するようにすることは簡単にできる&lt;br /&gt;
*インターフェースはミックスインを定義するのには理想的&lt;br /&gt;
*インターフェースは階層を持たない型フレームワークを構築することを可能にする&lt;br /&gt;
*ラッパークラスイデオムを通じて、インターフェースは安全で強力な機能拡張を可能にする&lt;br /&gt;
*抽象 骨格実装クラス(skeletal implementation) を外部に公開する重要なインターフェースごとに提供することで、インターフェースと抽象クラスの長所を組み合わせることができる。&lt;br /&gt;
&lt;br /&gt;
===型を定義するためだけにインターフェースを利用する===&lt;br /&gt;
*定数インタフェース(static final フィールドのみからなる)は下手な使い方&lt;br /&gt;
*enum型か、インスタンス化不可なユーティリティクラスを使うべき&lt;br /&gt;
*インターフェースは型を定義するためだけに使用する&lt;br /&gt;
&lt;br /&gt;
===タグつきクラスよりクラス階層を選ぶ===&lt;br /&gt;
====タグつきクラス====&lt;br /&gt;
*インスタンスが2つ以上の特性を持っていて、その特性を示すタグフィールドを持つクラス&lt;br /&gt;
=====例- 円か四角かを表現できるクラス=====&lt;br /&gt;
*冗長で誤りやすく非効率&lt;br /&gt;
*クラス階層の面白みのない模倣に過ぎない&lt;br /&gt;
 class Figure {&lt;br /&gt;
   enum Shape = { RECTANGLE, CIRCLE };&lt;br /&gt;
   final Shape shape;&lt;br /&gt;
         :&lt;br /&gt;
        &lt;br /&gt;
    &lt;br /&gt;
===戦略を表現するために関数オブジェクトを使用する===&lt;br /&gt;
*java は関数ポインタを提供していないが、同じ効果を得るためにオブジェクト参照を利用できる&lt;br /&gt;
*他のオブジェクトを操作するメソッドを1つだけ公開するようなオブジェクトは関数オブジェクトと呼ばれる&lt;br /&gt;
*具象戦略クラスは、典型的には、オブジェクトは状態を持たないので、シングルトンにするのが適している。&lt;/div&gt;</summary>
		<author><name>Piroto</name></author>
		
	</entry>
</feed>