Tenth Chapter
(1) When an object of an inner class is generated. There is a connection between this object and the manufacturing of his peripheral object, so it can access all members of its peripheral objects without any special conditions.
In addition, the inner class has access to all elements of other peripheral classes.
(2). This assumes that you need to generate an application for an external partial object. You can use the name of the external class immediately following the origin and this.
. New assumes that you want to create an object of an inner class, you must add an instance of the outer class with a. New
such as: dotnew DN = new Dotnew ();
Dotnew.inner dni = dn.new Inner;
(3) Remember.
All members of the interface are set to public () on their own initiative;
(4) Suppose an anonymous inner class or a local inner class is defined. And you want it to use an object that is defined externally, then the compiler expects the reference to be final.
11th Chapter
(1) Collection derivative 3 in the container. List,set. Queue List, which stores a set of data in a specific order; Set, elements cannot be repeated. Queue, which simply agrees to insert an object at one end of the container and remove the object from the other end.
The map stores two objects in each slot. The value that is checked and associated with the child.
(2) Hashlist, HashMap is the fastest way to get elements
Treelist, TreeMap storage order according to letter ascending
Linkedhashset, Linkedhashmap storage according to the order to be added
(3) Iterator iterator has next (), Hasnext (), remove () Three ways
Subclass Listiterator is more powerful, with next (). Hasnext (), Nextindex (). Previous (), hasprevious (), Previoueindex () method,
In addition, Listiterator can use the set () method to replace the current node and be able to generate a listiterator that points to an n element by calling Listiterator (n).
Listiterator Implementation Flashback:
Import Java.util.*;import Xpf.test;public class Listiteration {public static void main (String args[]) { list<integer> s =new arraylist<integer> (8); Collections.addall (s,0,1,2,3,4,5,6,7); Listiterator<integer> it = S.listiterator (); It=s.listiterator (S.size ()-1); while (It.hasprevious ()) { System.out.println (" " +it.previous ());} System.out.println ();}}
Title: Use the string "key" and the object you selected to populate the Linkedhashmap. It then extracts the key-value pairs, sorts the key values, and then inserts the map again
Import java.util.*;import static org.greggordon.tools.print.*;p ublic class ex24{public static void Main (string[] args) { map<string,integer> m = new linkedhashmap<string,integer> () M.put ("Ten") M.put ("Nine", 9); M.put (" Eight ", 8); M.put (" Seven ", 7), M.put (" Six ", 6), M.put (" Five ", 5), M.put (" Four ", 4), M.put (" three ", 3), M.put (" the ", 2); M.put ("One", 1); M.put ("Zero", 0);p rintln ("Map to sort:" + m);//temporary MAP to hold entrys:map<string,integer> MT EMP = new linkedhashmap<string,integer> ();//Use TreeSet to sort the KeySet ():set<string> ss = new treeset< String> (M.keyset ());//mover sorted keys to temp map:iterator<string> ITSS = Ss.iterator (), while (Itss.hasnext ( ) {string s = (string) itss.next (); Integer i = M.get (s); M.remove (s); Mtemp.put (S, i);} Get sorted list of temp keys:set<string> sstemp = new treeset<string> (Mtemp.keyset ());//move sorted Entrys Back to map:iterator<string> itsstemp = Sstemp.iterator (), while (itsstemp.hasnExt ()) {String s = (string) itsstemp.next (); Integer i = Mtemp.get (s); Mtemp.remove (s); M.put (S, i);} Done with Temp:mTemp.clear ();p rintln ("Sorted map:" + M);}}
(4) Priorityqueue
Only the first element of the queue is guaranteed to be the most important, and the other elements inside are not guaranteed to be ranked by importance.
In fact it is in the maintenance of a maximum heap.
Specific References http://blog.csdn.net/chengyingzhilian/article/details/8078032
Java Programming thought notes