JDK source of the util utility class

2010-06-29  来源:本站原创  分类:Java  人气:130 

BitSet: bit set to achieve a common logical operation.

Calendar: Date of many obsolete methods in such a reality. It is an abstract class, there are two implementations were GregorianCalendar and JapaneseImperialCalendar

Formatter: String.format () method is in fact built a Formatter to format the new operation, to provide the print format similar to C language output.

Locale: Locale to perform its task is called locale-sensitive operation of the operation.

Observer Interface and Observable Class : JDK provides the framework to achieve observer pattern, under this framework: Observer Object should implement the Observer interface (only update method), by observers as a subclass of Observable, Observable can add / remove any more than between one Observer,
When the call is actually called when notifyObservers held Observable Observer's update method. This framework is not easy to use, with the inherited way limit the scope of its application.

Properties: A very popular class, but few know that it is inherited from the HashTable, this design is not good, because you can even call the parent class, add method to join non-String's Key, are damned to please a bad inheritance better design should be allowed to hold HashTable Properties class reference, with the combination of problem-solving.
Here is a misuse of inheritance examples of live fresh fresh!!! GetProperty not add synchronized, and setProperty added synchronized keyword.

RandomAccess: with this interface can support the tag of the form get (i) fast access, in general, Array implementation support fast access, while maintaining Linked to achieve because only a headNode perhaps sub tailNode, and get (i) when it was down Zhaoyazhaoya node from scratch, of course, low efficiency of friends. Has been tested in the ArrayList's iterator () compared to direct for () (get (i))
Slightly more slowly (but bring the benefits of unified interface), while LinkedList of iterator () than for () (get (i)) on the number of higher efficiency.

Random: This class is a mechanism to change the default seed, the original is the current time in milliseconds as a seed, so if the CPU fast enough in the same loop may be taken out of the same seed. Ms now become a nanosecond, but also with static variables from the increase, in theory, it is impossible for the seeds of the same.

Scanner: One can use regular expressions to parse primitive types and strings of simple text scanner, combined with System.in to use it very good.

TimeZone: Time zone-related, a default implementation is SimpleTimeZone.

Timer: Timer can execute a fixed time or delay the implementation of the (TimeTask implemtns Runalbe), you can periodically the implementation of the thread (TimeTask). In fact, Timer which maintained TaseQueue, the Queue the next execution time by task order (small top of the heap), the implementation of a TimeTask will complete the implementation according to the time the next appropriate wait (fixTime) rather than the air circulation, thus improving efficiency .

UUID: using the time machine with the card or some other parameters to make the hash, basically to ensure uniqueness.

相关文章
  • JDK source of the util utility class 2010-06-29

    BitSet: bit set to achieve a common logical operation. Calendar: Date of many obsolete methods in such a reality. It is an abstract class, there are two implementations were GregorianCalendar and JapaneseImperialCalendar Formatter: String.format () m

  • [JDK optimization strategy] java.util.Arrays sort of 2010-05-12

    On the inscription: JDK, there are many algorithm has the bright spot, it is worth to study. ] [Java.uti.Arrays to operate the array contains (such as sorting and searching) in various ways. This article we study a number of masters to write sorting

  • [YUI source learning] YUI Get Utility dynamic loading mechanism 2010-09-01

    [Note] YUI before the analysis is aimed at YUI 2.8 version. On the dynamic loading First is that on which a method of dynamic loading and dynamic loading have any effect. Sometimes the development page, you need to load a lot of js files. Js file for

  • Eclipse JDK source associated 2010-05-16

    Original link: http://ajava.org/course/tool/14485.html 1. Point "window" -> "Preferences" -> "Java" -> "Installed JRES" 2. Then "Installed JRES" is the right list pane, lists the system JRE enviro

  • JDK source of the miscellanies 2010-06-29

    java.util: util.regex on the regular expression handling package, which is the lengthy processing logic, no depth, that is, a common Pattern and Matcher, combination of these two classes to finish the regular expression programming, but based on past

  • ubuntu install jdk source 2010-12-26

    sudo apt-get install sun-java6-source To install the JDK's source, install in the directory / usr/lib/jvm/java-6-sun-1.xxxx sudo apt-get source sun-java6-bin Source version of the JDK installation

  • JDK source research 2Java set design 2010-06-29

    Collection Interface System: Iterable ----> Collection ----> List ----> Set ----> SortedSet ----> NavigableSet (6.0) ----> Queue ----> Deque Map ----> SortedMap ----> NavigableMap (6.0) Collection class system: Collection ----&g

  • JDK source code of the concurrent 2010-06-29

    ava.util.concurrent package contains the framework of Java concurrent programming solution 1, synchronized: each object in JAVA actually has a hidden lock object, as to the method with the equivalent of the object when szhcnronized with synchronized

  • JDK source code of the sql package 2010-06-29

    java.sql 1, JDBC is a set of protocols, is JAVA developers and database vendor agreement, that is, a set of interfaces defined by the Sun, by the database vendor to implement, and provides for JAVA developers to access the database used by the method

  • JDK source learning - LinkedList 2010-06-04

    public class LinkedList<E> extends AbstractSequentialList<E> implements List<E>, Deque<E>, Cloneable, java.io.Serializable private transient Entry<E> header = new Entry<E>(null, null, null); // The head of the queue pub

  • JDK source of the 1 (Lang Pack Supplements) 2010-06-29

    1, the basic type of the corresponding object types: We know the basic types in Java: void byte char double float integer long short The corresponding object types, respectively: Void Byte Character Double Float Integer Long Short, In fact, these cla

  • JDK source code of the IO of 2010-06-29

    A typical IO operation is the read InputStream and OutputStream to wite (byte b) as the standard, InputStream time to receive one or more bytes, while the OutputStream will write one or more bytes. Emerged from JDK1.1 to start operating as a standard

  • JDK source of the bean bag 2010-06-29

    java.beans 1, Statement Can perform the specified method, but can not get return value 2, Exception is a subclass of Statement, the specified method and return value are specified in the Java method name in the implementation of the method can be use

  • JDK ArrayList Source Analysis 2010-12-22

    Today looked at the source ArrayList to write about their own experiences ArrayList first integrated system, the code is as follows: public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, java.io.S

  • JDK LinkedList Source Analysis 2010-12-23

    Then today, another of about JDK collection classes in the LinkedList. public class LinkedList<E> extends AbstractSequentialList<E> implements List<E>, Deque<E>, Cloneable, java.io.Serializable As you can see the same LinkedList an

  • Arrays.asList returns ArrayList is not a java.util.ArrayList, call the newspaper UnsupportedOperationException 2010-09-14

    Calling code: String[] tmpIds = ids.split(","); rt = Arrays.asList(tmpIds); rt.add(String.valueOf(userId)); Arrays.asList (tmpIds) returns a fixed-size list /** * Returns a fixed-size list backed by the specified array. (Changes to * the returne

  • JDK learning search algorithm 2010-04-13

    Today we learn of two commonly used search algorithms: sequential search and binary search, no BS, the first on the code, later analysis: 1. Here are two kinds of search algorithm, in which the second taken from the JDK source code: Sequential search

  • DataInputStream class design error source 2010-05-08

    I am a Java beginner, please predecessors Xiangjie. Yesterday, when this part of learning Java stream, see jdk source code, personal feel sun in the design DataOutputStream this class is not appropriate or even a BUG. DataInputStream in a method read

  • java.util.ConcurrentModificationException solution 2010-07-12

    Today in the project, there is a demand, need a Set type collection to meet the conditions to remove the object, then assumed a direct call to mind Set the remove (Object o) method to delete the specified object can test the code: public class Test (

  • [Original] by using a collection iterator to be updated. Delete operation, there java.util.ConcurrentModificationException solution. 2010-07-14

    In the project there is a demand, need a Set type collection to meet the conditions to remove the object, then take it for granted thought to directly call Set the remove (Object o) method to delete the specified object can be. However, when running