Regular expressions are a very powerful capability that we only touched on in this chapter.
The important elements we've covered are:
The java.util.Arrays class provides static methods for sorting, searching, filling, and comparing arrays.
Objects of type Random can generate pseudo-random numbers of type int, long, float, and double. The integers are uniformly distributed across the range of the type int or long. The floating point numbers are between 0.0 and 1.0. You can also generate numbers of type double with a Gaussian distribution with a mean of 0.0 and a standard deviation of 1.0, and random boolean values.
Classes derived from the Observable class can signal changes to classes that implement the Observer interface. You define the Observer objects that are to be associated with an Observable class object by calling the addObserver() method. This is primarily intended to be used to implement the document/view architecture for applications in a GUI environment.
You can create Date objects to represent a date and time that you specify in milliseconds since January 1, 1970, 00:00:00 GMT, or the current date and time from your computer clock.
A GregorianCalendar object represents a calendar set to an instant in time on a given date.
A regular expression defines a pattern that is used for searching text.
In Java a regular expression is compiled into a Pattern object that you can then use to obtain a Matcher object that will scan a given string looking for the pattern.
The appendReplacement() method for a Matcher object enables you to make substitutions for patterns found in the input text.
A capturing group in a regular expression records the text that matches a sub-pattern.
By using capturing groups you can rearrange the sequence of substrings in a string matching a pattern.