<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://classes.engineering.wustl.edu/cse231/core/index.php?action=history&amp;feed=atom&amp;title=Interfaces</id>
	<title>Interfaces - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://classes.engineering.wustl.edu/cse231/core/index.php?action=history&amp;feed=atom&amp;title=Interfaces"/>
	<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Interfaces&amp;action=history"/>
	<updated>2026-11-27T04:02:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.4</generator>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Interfaces&amp;diff=23&amp;oldid=prev</id>
		<title>Finn at 05:16, 31 January 2017</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Interfaces&amp;diff=23&amp;oldid=prev"/>
		<updated>2017-01-31T05:16:48Z</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;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 05:16, 31 January 2017&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-l9&quot; &gt;Line 9:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&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;An ''implementation'' or ''implementing class'' is a normal Java class that implements the methods in the interface. In other words, the interface describes what the methods are, and the implementation describes what those methods do internally. All of the methods defined in an interface must be implemented in the implemented class (unless the class is abstract). The power of an interface comes from the fact that multiple classes can implement the same interface.&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;An ''implementation'' or ''implementing class'' is a normal Java class that implements the methods in the interface. In other words, the interface describes what the methods are, and the implementation describes what those methods do internally. All of the methods defined in an interface must be implemented in the implemented class (unless the class is abstract). The power of an interface comes from the fact that multiple classes can implement the same interface.&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;A &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;[https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html &lt;/del&gt;lambda&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;] &lt;/del&gt;is a special case of implementing class for an interface with only one method. Lambdas are discussed more extensively on the Lambdas page.&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;A lambda is a special case of implementing class for an interface with only one method. Lambdas are discussed more extensively on the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[&lt;/ins&gt;Lambdas&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]] &lt;/ins&gt;page.&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;== Examples ==&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;== Examples ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Interfaces&amp;diff=22&amp;oldid=prev</id>
		<title>Finn at 05:15, 31 January 2017</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Interfaces&amp;diff=22&amp;oldid=prev"/>
		<updated>2017-01-31T05:15:52Z</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;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 05:15, 31 January 2017&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-l18&quot; &gt;Line 18:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 18:&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;However, these examples are still rather contrived. For a real example of a Java interface, take a look at the [https://docs.oracle.com/javase/8/docs/api/java/util/List.html List] interface. If you look at [http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/List.java the source], you will notice that none of the methods have bodies; they're simply definitions of methods that a list should have. The Java Development Kit has several implementations of the List interface, most notably [https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html ArrayList] and [https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html LinkedList]. Internally, these classes store data very differently. ArrayList has an array that stores elements, while LinkedList has a chain of list &amp;quot;nodes.&amp;quot; Because both of these classes implement the List interface however, either one could be passed into a method that takes a List as a parameter.&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;However, these examples are still rather contrived. For a real example of a Java interface, take a look at the [https://docs.oracle.com/javase/8/docs/api/java/util/List.html List] interface. If you look at [http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/List.java the source], you will notice that none of the methods have bodies; they're simply definitions of methods that a list should have. The Java Development Kit has several implementations of the List interface, most notably [https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html ArrayList] and [https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html LinkedList]. Internally, these classes store data very differently. ArrayList has an array that stores elements, while LinkedList has a chain of list &amp;quot;nodes.&amp;quot; Because both of these classes implement the List interface however, either one could be passed into a method that takes a List as a parameter.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=== An Added Benefit ===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&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 style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;A key feature of interfaces is that the implementing classes don't have to be from the same package or library as the interface. In other words, you could create your own List implementation, so long as it implemented all of the methods in the List interface. The benefit to this is that a method can simply require a List as a parameter, and any class that implements List will be accepted. If you created your own List implementation that stores data in a unique way, you could still call the [https://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#sort(java.util.List) Collections.sort()] method on it. This powerful construct is what allows lambdas to function.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
	<entry>
		<id>http://classes.engineering.wustl.edu/cse231/core/index.php?title=Interfaces&amp;diff=21&amp;oldid=prev</id>
		<title>Finn: Created page with &quot;Interfaces in Java can be a powerful tool, allowing you to abstract away implementation details. For CSE 231, you will never be required to write your own interfaces for any o...&quot;</title>
		<link rel="alternate" type="text/html" href="http://classes.engineering.wustl.edu/cse231/core/index.php?title=Interfaces&amp;diff=21&amp;oldid=prev"/>
		<updated>2017-01-28T19:12:10Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Interfaces in Java can be a powerful tool, allowing you to abstract away implementation details. For CSE 231, you will never be required to write your own interfaces for any o...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Interfaces in Java can be a powerful tool, allowing you to abstract away implementation details. For CSE 231, you will never be required to write your own interfaces for any of our assignments; however, whenever you use lambdas, you are implementing an existing interface, and it can be useful to understand exactly what an interface is and what lambdas are doing behind the scenes.&lt;br /&gt;
&lt;br /&gt;
== Terminology ==&lt;br /&gt;
&lt;br /&gt;
An ''interface'' is, most simply, a group of related methods with empty bodies. An interface is used to describe methods that a class should have, without actually giving the details on exactly what the class does internally. In the same way that a class is a blueprint for an object, an interface is a blueprint for a class.&lt;br /&gt;
&lt;br /&gt;
To ''implement'' a method is to write the code that describes what it does internally. An ''umimplemented'' or ''abstract'' method is one that has no method body. All of the methods in an interface are abstract.&lt;br /&gt;
&lt;br /&gt;
An ''implementation'' or ''implementing class'' is a normal Java class that implements the methods in the interface. In other words, the interface describes what the methods are, and the implementation describes what those methods do internally. All of the methods defined in an interface must be implemented in the implemented class (unless the class is abstract). The power of an interface comes from the fact that multiple classes can implement the same interface.&lt;br /&gt;
&lt;br /&gt;
A [https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html lambda] is a special case of implementing class for an interface with only one method. Lambdas are discussed more extensively on the Lambdas page.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
[https://docs.oracle.com/javase/tutorial/java/concepts/interface.html The Java Tutorials] has a simple example of a Bicycle interface and a ACMEBicycle implementing class. Notice how the methods in the Bicycle interface don't have bodies. In this example, the interface isn't particularly useful; if an interface only has one implementing class, you may as well just have the implementing class.&lt;br /&gt;
&lt;br /&gt;
[https://www.tutorialspoint.com/java/java_interfaces.htm TutorialsPoint] has a more in-depth explanation of how interfaces work in Java. It's recommended that you read through this if you don't understand how interfaces work.&lt;br /&gt;
&lt;br /&gt;
However, these examples are still rather contrived. For a real example of a Java interface, take a look at the [https://docs.oracle.com/javase/8/docs/api/java/util/List.html List] interface. If you look at [http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/List.java the source], you will notice that none of the methods have bodies; they're simply definitions of methods that a list should have. The Java Development Kit has several implementations of the List interface, most notably [https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html ArrayList] and [https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html LinkedList]. Internally, these classes store data very differently. ArrayList has an array that stores elements, while LinkedList has a chain of list &amp;quot;nodes.&amp;quot; Because both of these classes implement the List interface however, either one could be passed into a method that takes a List as a parameter.&lt;/div&gt;</summary>
		<author><name>Finn</name></author>
		
	</entry>
</feed>