From 70fef02fcf07bd1a8a81b0480d32129bb7e16158 Mon Sep 17 00:00:00 2001 From: Zuhayr Elahi Date: Tue, 22 Sep 2015 09:43:27 -0700 Subject: [PATCH 1/4] Update README.md --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index d6100f6..760408e 100644 --- a/README.md +++ b/README.md @@ -610,6 +610,20 @@ create.select(BOOK.TITLE, AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME) Using this and the [DAO][dao] pattern, you can make database access a breeze. +## Collections and Generics + +Java has a collection framework which is used to implement complex data structures. This framework helps to: reduce programming effort, increases performance, its part of the core API which means it is available and easy to learn, promotes software reuse, and the APIs are easy to design based on the generic collections. It consists of collection interfaces, general-purpose implementations, special-purpose implementations, concurrent implementations, wrapper implementations, abstract implementations, algorithms, infrastructure, and array utilities. + + + ### Interfaces + Interfaces are a binding contract which consists of abstract methods and fields that must be implemented by any class that extends the interface. + + [java.util.Collection][collections] is the root interface. It represents a group of Objects. More specific collection interfaces such as List extend this interface. + + The [java.util.List][lists] interface extends from the Collection interface. The List interface helps to manage an ordered collection of objects, where it can control where each element is inserted, how to access elements based on the index, search for elements in the list, and insert duplicate values. Use the List itnerface when the collection of objects is being dynamically resized. The two most commonly used Lists which implement this interface are: [java.util.ArrayList][arraylist] and [java.util.LinkedList][linkedlist]. An ArrayList is used when the list becomes fairly static after the information is inserted. A LinkedList is used when there are frequent insertions or deletions. + + + ## Testing Testing is critical to your software. These packages help make it easier. @@ -853,3 +867,7 @@ Resources to help you become a Java master. [playdoc]: http://www.playframework.com/documentation/2.3.x/Anatomy [java8datetime]: http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html [checkedex]: http://docs.oracle.com/javase/7/docs/api/java/lang/Exception.html +[collection]: https://docs.oracle.com/javase/6/docs/api/java/util/Collection.html +[list]: https://docs.oracle.com/javase/6/docs/api/java/util/List.html +[arraylist]: http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html +[linkedlist]: http://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html From de49520c86f3d56883cc786f09c881368ad5442b Mon Sep 17 00:00:00 2001 From: Zuhayr Elahi Date: Tue, 22 Sep 2015 09:45:46 -0700 Subject: [PATCH 2/4] Update README.md added information on java collections and generics --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 760408e..99bac5a 100644 --- a/README.md +++ b/README.md @@ -615,7 +615,7 @@ Using this and the [DAO][dao] pattern, you can make database access a breeze. Java has a collection framework which is used to implement complex data structures. This framework helps to: reduce programming effort, increases performance, its part of the core API which means it is available and easy to learn, promotes software reuse, and the APIs are easy to design based on the generic collections. It consists of collection interfaces, general-purpose implementations, special-purpose implementations, concurrent implementations, wrapper implementations, abstract implementations, algorithms, infrastructure, and array utilities. - ### Interfaces +### Interfaces Interfaces are a binding contract which consists of abstract methods and fields that must be implemented by any class that extends the interface. [java.util.Collection][collections] is the root interface. It represents a group of Objects. More specific collection interfaces such as List extend this interface. From 232f3e6cdb84ba9c0234f29f13ae50cd6606e4ba Mon Sep 17 00:00:00 2001 From: Zuhayr Elahi Date: Tue, 22 Sep 2015 14:28:57 -0700 Subject: [PATCH 3/4] Update README.md Added information regarding Sets and Sortedsets --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 99bac5a..060d742 100644 --- a/README.md +++ b/README.md @@ -620,7 +620,12 @@ Java has a collection framework which is used to implement complex data structur [java.util.Collection][collections] is the root interface. It represents a group of Objects. More specific collection interfaces such as List extend this interface. - The [java.util.List][lists] interface extends from the Collection interface. The List interface helps to manage an ordered collection of objects, where it can control where each element is inserted, how to access elements based on the index, search for elements in the list, and insert duplicate values. Use the List itnerface when the collection of objects is being dynamically resized. The two most commonly used Lists which implement this interface are: [java.util.ArrayList][arraylist] and [java.util.LinkedList][linkedlist]. An ArrayList is used when the list becomes fairly static after the information is inserted. A LinkedList is used when there are frequent insertions or deletions. + The [java.util.List][lists] interface helps to manage an ordered collection of objects, where it can control where each element is inserted, how to access elements based on the index, search for elements in the list, and insert duplicate values. The two most commonly used Lists which implement this interface are: [java.util.ArrayList][arraylist] and [java.util.LinkedList][linkedlist]. + + The [java.util.Set][set] is used to manage a collection of objects which contain no duplicates. The [java.util.SortedSet][sortedset] interface is used if the elements are automatically order. The classes implementing the Set interface are: + 1. [java.util.HashSet][hashset] - Hash table implementation of the Set interface + 2. [java.util.LinkedHashSet][linkedhashset] - Hash table and linked list implementation of the Set interface + 3. [java.util.TreeSet][treeset]: A red-black tree implementation of the SortedSet interface @@ -871,3 +876,8 @@ Resources to help you become a Java master. [list]: https://docs.oracle.com/javase/6/docs/api/java/util/List.html [arraylist]: http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html [linkedlist]: http://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html +[set]: http://docs.oracle.com/javase/7/docs/api/java/util/Set.html +[sortedset]: http://docs.oracle.com/javase/7/docs/api/java/util/SortedSet.html +[hashset]: http://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html +[linkedhashset]: http://docs.oracle.com/javase/7/docs/api/java/util/LinkedHashSet.html +[treeset]: http://docs.oracle.com/javase/7/docs/api/java/util/TreeSet.html From c69659cacbf3135bdfef58fd6eea8c61501d9cac Mon Sep 17 00:00:00 2001 From: Zuhayr Elahi Date: Tue, 22 Sep 2015 14:49:41 -0700 Subject: [PATCH 4/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 060d742..b2661a8 100644 --- a/README.md +++ b/README.md @@ -618,7 +618,7 @@ Java has a collection framework which is used to implement complex data structur ### Interfaces Interfaces are a binding contract which consists of abstract methods and fields that must be implemented by any class that extends the interface. - [java.util.Collection][collections] is the root interface. It represents a group of Objects. More specific collection interfaces such as List extend this interface. + [java.util.Collection][collection] is the root interface. It represents a group of Objects. More specific collection interfaces such as List extend this interface. The [java.util.List][lists] interface helps to manage an ordered collection of objects, where it can control where each element is inserted, how to access elements based on the index, search for elements in the list, and insert duplicate values. The two most commonly used Lists which implement this interface are: [java.util.ArrayList][arraylist] and [java.util.LinkedList][linkedlist].