Java 12 features
There are some interesting and useful features available in Java 12. However some are in Preview stage, not for production use. All Preview features are labelled accordingly. Compact Number Formatting Java 12 comes with number formatter the CompactNumberFormat. It was designed to represent number in shorter form based on patterns provided by given locale. NumberFormat shortNumber = NumberFormat.getCompatcNumberInstance(new Locale("en", "US"), NumberFormat.Style.SHORT); shortNumber.format(1000); output: 10k Try what output you get when you try Style.LONG. Teeing Collector in Stream API Collector<T, ?, R> teeing(Collector<? super T, ?, R1> downstream1, Collector<? super T, ?, R2> downstream2, BiFunction<? super R1, ? super R2, R> merger) Every element is processed by both the downstream collectors and their results are passed to merger function. The example of teeing collector is shown below If we want to calculate average from set of num...