NJIT CS 602 - Object Oriented Software Development Using Java

Unformatted text preview:

Slide 1CS 602 Java and the WebApplication FrameworksExpected knowledgeChapter notesAbstract Collection TypesMethods of Interface CollectionMethods of Interface ListMethods of Interface MapTypes of SetsConcrete CollectionsOrderingDefining Orders on ObjectsWord Frequency exampleJava Graphical User InterfacesAbstract Windows ToolkitUnderstanding LayoutsBibliographyGeorge BlankUniversity LecturerCS 602Java and the WebObject Oriented Software Development Using JavaChapter 8Application Frameworks•Java has an extensive collection of application frameworks, collections of cooperating classes that can be used in developing applications.•Chapter 8 emphasizes three such frameworks—collections, input/output and GUIs using AWT and Swing.Expected knowledge•Students should not only understand and be able to use the classes described in the text, but must also develop skill in using Java documentation to go beyond the material in the text.•It is recommended that students become familiar with http://java.sun.com/reference/docs/index.html•Another good site: http://javadocs.org/Chapter notes•There is so much in this chapter that I hesitate to add more to the readings.•I do recommend that students make certain that they understand the topics described in the chapter summary.Abstract Collection Types•A bag or multiset is an unordered collection of elements that may include duplicates. A bag, in Java the Collection interface, is the least restrictive and most general form of collection.•A set is an unordered collection of elements without duplicates.•A list is an ordered collection of elements.•A map, dictionary or associative array is an unordered collection of key-value pairs.Methods of Interface Collection•add(element)•addAll(collection)•clear()•contains(element)•containsAll(collection)•isEmpty()•iterator()•remove(element)•removeAll(collection)•retainAll(collection)•size()Methods of Interface List•add(i,element)•add(element)•addAll(collection)•addAll(i,collection)•get(i)•indexOf(element)•lastIndexOf(element)•containsAll(collection)•listIterator()•listIterator(i)•remove(i)•remove(element)•removeAll(collection)•set(i,element)•subList(i,j)Methods of Interface Map•clear()•containsKey(k)•containsValue(v)•entrySet()•get(k)•isEmpty()•keySet()•put(k,v)•put(map)•remove(k)•removeAll(collection)•size()•values()k = keyv = valueTypes of Sets•A HashSet stores elements in a hash table.•A LinkedHashSet is an ordered hash table.•A TreeSet stores elements in a balanced binary tree.Concrete CollectionsSets•HashSet•LinkedHashSet•TreeSet1Lists•Array List•Linked List•VectorMaps•HashMap•IndentityHashMap•LinkedHashMap•TreeMap1•Hashtable1sortedOrdering•An order (technically a partial order) is a transitive binary relationship between two objects. Organized by some criteria, if a has a certain relationship with b and b has the same relationship with c, then a has that relationship with c.•A sorted collection is one that orders its elements by a particular relationship.Defining Orders on Objects•A class can define a natural order among its instances by implementing the comparable interface.•Arbitrary orders among different objects can be defined by comparators, or classes that by implement the comparator interface.•SortedSet and SortedMap are sorted abstract collections that inherit the functions of sets and maps respectively.Word Frequency example•The Class WordFrequency2 on pages 327-328 shows an example of using a sorted map sorted by their natural keys. It first orders the words in a piece of text and then counts the identical words to determine their frequency. Class WordFrequency4 on page 332 extends this to sort the result and display the words in frequency order.Java Graphical User Interfaces•Java has a GUI framework consisting of several categories of classes:•GUI Components (widgets) have a characteristic appearance (look) and behavior (feel).•Layout managers package components in windows. (see FlowLayout and BorderLayout)•Events and Event Listeners•Grapics and Imaging classesAbstract Windows Toolkit•The basic Java GUI toolkit is the Abstract Windows Toolkit (AWT) The Swing package is an extension of AWT to build high quality GUIs.•Review the hierarchy of awt at http://java.sun.com/j2se/1.5.0/docs/api/java/awt/package-tree.html to see the wde variety of classes available to build GUI applications.•The Java Class hierarchy is a good starting place to understand Java libraries: http://java.sun.com/j2se/1.5.0/docs/api/overview-tree.htmlUnderstanding Layouts•It is important to practice using the layouts such a flow layouts in order to understand how to present information attractively to the end user. Problem 8.5 in the text is a good exercise for this purpose.Bibliography•Jia, Xiaoping, Object Oriented Software Development Using Java. Addison Wesley,


View Full Document

NJIT CS 602 - Object Oriented Software Development Using Java

Download Object Oriented Software Development Using Java
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Object Oriented Software Development Using Java and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Object Oriented Software Development Using Java 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?