Home » Java » Core Java (page 30)

Core Java

Java 10 – Local Variable Type Inference

In this article we will see a Java10 feature called Local Variable Type Inference proposed as part of JEP 286. From the first version of Java it is strongly typed language where we need to mention each variable data type. We all were feeling Java is verbose language and expecting precise, compact way of writing Java . Java 8 addressed ...

Read More »

Peeking Inside Java Streams with Stream.peek

For a Java developer new to JDK 8-introduced pipelines and streams, the peek(Consumer) method provided by the Stream interface can be a useful tool to help visualize how streams operations behave. Even Java developers who are more familiar with Java streams and aggregation operations may occasionally find Stream.peek(Consumer) useful for understanding the implications and interactions of complex intermediate stream operations. ...

Read More »

Zuul 2 – Sample filter

Zuul 2 has finally been open sourced. I first heard of Zuul 2 during Spring One 2016 talk by Mikey Cohen is available here, it is good to finally be able to play with it. To quickly touch on the purpose of a Gateway like Zuul 2 – Gateways provide an entry point to an ecosystem of microservices. Since all ...

Read More »

Thread Methods destroy() and stop(Throwable) Removed in JDK 11

The message “RFR(s): 8204243: remove Thread.destroy() and Thread.stop(Throwable)” by @DrDeprecator (Stuart Marks) on the core-libs-dev OpenJDK mailing list is a request for review (RFR) of a change set associated with JDK-8204243 [“remove Thread.destroy() and Thread.stop(Throwable)”]. Both the bug report and the mailing list message describe the history of these two referenced Thread methods and explain that neither method really does ...

Read More »

[JDK 11] Class Loader Hierarchy Details Coming to jcmd

I’ve been a fan of the diagnostic command-line tool jcmd since hearing about jcmd at JavaOne 2012. I’ve used this tool extensively since then and have blogged multiple times about this tool: jcmd: One JDK Command-Line Tool to Rule Them All Determining the Active HotSpot Garbage Collector Programmatic jcmd Access JavaOne 2012: Diagnosing Your Application on the VM After numerous ...

Read More »

JDK 9/10/11: Side Effects from += on Java String

The question “Why does `array[i++%n] += i+” “` give different results in Java 8 and Java 10?” was posted earlier this week on StackOverflow.com. It points to a bug in the Java compiler that is present in JDK9 and later, but is not present in JDK8. As explained on the StackOverflow thread, Didier L provided a simple example of Java ...

Read More »

API Updates in Java SE 11 (18.9)

Java SE 11, which is also named as 18.9 (based on the new naming scheme which uses the year and month of release), is slated to be GA during the last week of September. The new approach for releasing new JDK version frequently is allowing the language creators to introduce new features, API updates more quickly to the developer community. ...

Read More »

Binary Search in Java without Recursion – Iterative algorithm

This week’s task is to implement binary search in Java, you need to write both iterative and recursive binary search algorithm. In computer science, a binary search or half-interval search is a divide and conquer algorithm which locates the position of an item in a sorted array. Binary search works by comparing an input value to the middle element of ...

Read More »