Textbook Learning Content Summary lambda syntax
- Lambda goes repeatable, conforms to dry principles, and lambda expressions are more readable and easier to operate
- The biggest problem with anonymous types is its redundant syntax, which is an anonymous method that provides a lightweight syntax that solves the redundancy problems associated with anonymous internal classes.
Interface default method: In JDK8, the interface definition can be added to the default action, or is called the default method (methods), the ForEach () method itself has operations, so it does not break iterable existing other operations. Data members cannot be used in the default method because the interface itself cannot define a data member, nor is it a process in which the default method cannot directly change state.
Functional and Stream API
- Use optional instead of NULL
- function interfaces for standard APIs
- Consumer: One parameter, no return value
- Function: A parameter that has a return value
- Predicate: A parameter that has a return value, the return value must be of type Boolean
- Supplier: No parameter, return value
- Stream and pipeline
Lambda and parallel processing part 13th-time and date recognize time and date
- Measurement of Time
- GMT (Greenwich Mean time): Not Standard Time now
- World Time (Universal time,ut): UT equivalent to GMT prior to 1972 UTC
- International Atomic Time (TAI): the definition of seconds
- World Coordination Time (corrdinated Universal, UTC): Leap seconds
- Unix time: 1970.1.1 00:00:00 the number of seconds to start
- Epoch:java.util.Date Epoch number of milliseconds
- Calendar
- Julian calendar (Julian calendar)
The Julian calendar is the predecessor of the current Gregorian calendar, used to replace the Ides, fixed the Roman calendar three years set a leap year error, four years to change a leap.
- Gregorian calendar (Gregorian calendar)
The Gregorian calendar will be the next day of the Julian calendar on Thursday, October 4, 1582, on Friday, October 15, 1582, for Gregorian calendar.
- ISO8601 Standard
ISO 8601 is not a calendar system, but a standard for time and date representations, a data interchange format that is intended to unify time and date. In the definition of ISO 8601, 19th century refers to 1900 to 1999, and the Gregorian calendar of 19th century means 1801 to 1900.
Recognize date and calendar
- Time zone: The z-symbol is typically identified on the temporal representation of the UTC offset.
- Date and DateFormat
- Date: The System.currenttimemillis () method is used to return an integer of type Long that represents the number of milliseconds elapsed since January 1, 1970 00:00:00, and is used only to obtain the epoch milliseconds.
- DateFormat is an abstract class whose operation class is Java.text.SimpleDateFormat, which is used to format the human understanding of the day of the month and seconds.
- Calendar: The operation of Time
- GetInstance (): To obtain a time-date information, or to operate on a time date, you can use the calendar instance to get a calendar instance through Calendar getinstance (), The default is to get GregorianCalendar instances
- GetTime (): After obtaining the calendar instance, you can use GetTime () to get the date instance
- Get (): You can use the Get () method to Specify the field enumeration constants on Calender if you want to get date and time fields such as month and date
- Add (): Change the time of the instance
- Roll (): If you intend to add or subtract a field only for a date, you can use the roll () method
- After (): compares the dates of two instances
- Before (): Comparing the dates of two instances
- ...
JDK8 New Time Date API
- Machine Time Instant
- The calendar gettime () returns an instance of False, gets the date instance, and the next step should get the time information, which should be the epoch milliseconds by the date's gettime ()
- The number of milliseconds that are used to represent a point in time after the custom Java epoch, which is essentially milliseconds. Use the static method of instant now () to obtain a instant instance representing the number of milliseconds in the Java epoch, and after obtaining the instant instance, you can use Plusseconds (), Plusmillis (), Plusnanos (), Minusseconds (), Minusmillis (), Minusnanos () do the operations on the timeline, the instant instance itself does not change, and these operations return a new instant instance, representing the instantaneous
Human time (ISO8601 standard)
- LocalDateTime: Includes date and time
- Localdate: only Date
- LocalTime: Only Time
- Zoneddatetime: Time zone date and time
- Offsetdatetime: Represents the UTC offset
- Year: Indicates years
- Yearmonth: Indicates the month
- Month: Indicates the monthly
- MonthDay: Indicates the day of the month
20145234 Huangfei "Java Programming" Seventh Week study summary