Java FAQ _09 Basic Class Library (002) _util Package what is the function

Source: Internet
Author: User
Tags base64 local time

Click to enter _ more _java FAQ-base Class Library

1, util package has what function

The Java.util package provides the underlying tools classes in Java. Includes base classes such as the basic Set framework and common tool classes. Main classes such as:

?

The Java.util package is broadly divided into two categories: collections, tools, and the following are some of the more commonly used classes:

Collection

    1. Bit Collection
      BitSet, only 0, 1 collections are stored.

    2. Data Collection
      Collection, a common collection container, including list, DataSet set, queue queues.
      MAP, key-value pair container.
      Dictionary, dictionary containers, and maps are very similar.
      Some of the data collection containers provided by Java are often used in the development process, and different containers have their own features that apply to different scenarios. Understanding the collection container look here: [What is a collection container][2]
      [2]:

    3. Collection Tools
      Collections, which provides common tools for collection containers.
      Arrays, which provides commonly used tools for arrays.

    4. iterators
      Iterator, an iterator that uses iterators to traverse an object.

Tools

  1. Character Set
    BASE64, provides encoding and decoding tools for Base64.

  2. Date Time
    Date, which provides the operation and processing of dates and times, and the time to get the current system.
    Calendar, a more powerful date processing tool than date, can be internationalized and the official recommended date tool.
    TimeZone, describes the time zone and provides an international foundation for the calendar.

  3. Currency
    Currency, describe the currencies of each country.

  4. Comparator
    Comparator, you can customize the sorting of a collection object or array object by implementing the Comparator interface.

  5. Data Statistics
    New features in Intsummarystatistics, Longsummarystatistics, Doublesummarystatistics,java 8, mainly used to statistically measure common statistical values of elements in a numeric array, such as: Maximum, Minimum, Average, sum, etc. Often used in conjunction with stream.

  6. Monitor
    EventListener, event listeners, want to use event snooping to implement it.
    EventObject, the event object that contains the data corresponding to the event, requires the custom class to inherit it.

  7. Observer Pattern
    Observable, the object interface to be observed, the object to be observed to implement the interface.
    Observer, the observer needs to implement the interface, when the observable object changes, Observer be notified, you can do the corresponding work.

  8. localization
    Locale, which describes the specific geographic, political, and cultural regions through which Java internationalization can be achieved.

  9. Object Tools
    Objects, provides common tool methods for Java objects, such as equality, comparison size, and so on.
    Optional, which can be hosted as a null container object, can avoid problems caused by null values by returning the object.

  10. Random number
    Random, which is used to generate stochastic numbers, the principle is to generate pseudo-random numbers by the number of seeds.
    UUID, you can generate 128-bit long, non-repeating numbers. It combines the machine's NIC, local time, and random number to generate the GUID. Theoretically, if a machine produces 10 million GUIDs per second, it can be guaranteed (in a probabilistic sense) that it will not repeat for 3,240 years.

  11. text
    Scanner, the main function is to simplify text scanning, and other functions such as retrieving text, parsing strings and basic types.

  12. Scheduling
    Timer, Timer tool, starts a separate thread outside the main thread to perform the specified scheduled task, which can be executed once or repeatedly.
    TimerTask, a task that can be performed by a timer, implements the Runnable interface.

Java FAQ _09 Basic Class Library (002) _util Package what is the function

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.