Friday, April 28, 2023

Java Concurrency: Condition

Previously we checked on ReentRantLock and its fairness. One of the things we can stumble upon is the creation of a Condition. By using Condition we can create mechanisms that allow threads to wait for specific conditions to be met before proceeding with their execution.The condition provides the...

Wednesday, April 26, 2023

Quiz yourself: Unmodifiable Map objects created from Java’s Map.of methods

It’s time to explore the world of key-value pairs.Given the following mapvar m = Map.of(1,2,3,4);Which code fragment is guaranteed to print 37 to the console? Choose one.A. m.forEach((x, y) -> System.out.print(x + y));  B. for (var v : m) {System.out.print(v.getKey() + v.getValue());}  C. for (var v : m.keySet())...

Monday, April 24, 2023

Curly Braces #10: The best way to measure Java developer productivity

Hint: It’s not found by counting the number of lines of code written each day.How do you measure programmer productivity? Some managers measure productivity by counting the number of software lines of code (usually abbreviated as either LoC or SLoC) written each day. I recall, decades ago, a...

Friday, April 21, 2023

Methods To Convert InputStream to String In Java

In Java, an InputStream is a common way to read data from a source, such as a file or network connection, in a stream-oriented way. Often times, it is necessary to convert an InputStream to a String to perform further processing on the data or to display it...

Thursday, April 20, 2023

Secrets To Landing Your First Job As A Oracle Java SE 8 Programmer

Java is a popular programming language that has been in use for over two decades. It has become one of the most popular programming languages in the world, powering applications and systems in various industries. Becoming an Oracle Certified Java SE 8 Programmer is a valuable investment for...

Wednesday, April 19, 2023

Quiz yourself: Interface methods and assignment compatibility in Java

What does it mean when a method has no modifiers—and a semicolon instead of a body?Given these four Java typespackage bot;interface Command {    String execute();}package bot;public class Engine {    public static void run(Command c) {        System.out.println(c.execute());    }}package bot;import bot.command.AboutCommand;public class Main { ...

Monday, April 17, 2023

What is JavaOne?

JavaOne is a technology conference held annually by Oracle Corporation for Java developers and enthusiasts. The conference provides an opportunity for Java developers to come together and learn about the latest Java technologies, tools, and best practices. In this article, we will explore the history, purpose, and highlights...

Friday, April 14, 2023

Bigtable Pagination in Java

Consider a set of rows stored in Bigtable table called “people”:My objective is to be able to paginate a few records at a time, say with each page containing 4 records:Page 1:Page 2:Page 3:High-Level ApproachA high level approach to doing this is to introduce two parameters:◉ Offset —...

Wednesday, April 12, 2023

Quiz yourself: Using the stream methods dropWhile and takeWhile in Java

It matters whether the stream is ordered or not ordered.Given the following method fragmentCollection<Integer> c = Set.of(1,2,3,4,5,6,7); // line 1var r = c.stream()  .dropWhile(e -> e < 5)  .takeWhile(e -> e < 7)  .count(); // line 2System.out.println(r);Which statement is correct? Choose one.A. Line 1 will cause an error.B. Replacing...

Friday, April 7, 2023

Quiz yourself: String manipulation and local and instance variables

Watch out for unexpected and undesirable side effects.Imagine that your colleague from the IT department is working on a new chatbot application implementing—among some others—the Command design pattern. The bot’s command objects are created once upon startup and reused through the life of the application. Below is the...

Wednesday, April 5, 2023

What is Oracle Java SE? Understanding the Most Popular Programming Language

Java is one of the most popular programming languages in the world, and for good reason. It is a versatile and efficient language that can be used to create applications, games, and even entire operating systems. In this article, we will explore Oracle Java SE, the latest version...

Pages (26)1234567 »