How to Add String Arrays to ArrayList in Java
Baeldung » Java
by Kai Yuan
10h ago
Learn how to add elements from multiple String arrays to an ArrayList in Java.         ..read more
Visit website
Add Jar Files to Java Project Using Visual Studio Code
Baeldung » Java
by Olayemi Michael
10h ago
Tutorial on how to add JAR files manually to a VSCode project.         ..read more
Visit website
Difference Between M2_HOME, MAVEN_HOME and using the PATH variable
Baeldung » Java
by Njabulo Mwandla
10h ago
Tutorial on the use and differences between the three Maven variables: M2_HOME, MAVEN_HOME, and PATH.         ..read more
Visit website
Java Weekly, Issue 552
Baeldung » Java
by baeldung
10h ago
Scoped values, effective logging, numerous Spring updates, deprecated JFR event, and rate limiting in APISIX.         ..read more
Visit website
Convert Between org.joda.time.DateTime and java.sql.Timestamp in Java
Baeldung » Java
by Rajat Garg
20h ago
Learn how to convert between org.joda.time.DateTime and java.sql.Timestamp classes in Java.         ..read more
Visit website
How to Convert Gson JsonArray to HashMap
Baeldung » Java
by Wynn Teo
4d ago
1. Introduction In this tutorial, we’ll explore how to convert a Gson JsonArray to a HashMap in Java. By the end of this tutorial, we’ll understand the process of iterating over a JsonArray, extracting its elements, and storing them in a HashMap. 2. Understanding Gson JsonArray and HashMap Structures A Gson JsonArray is a part of the Gson library and we use it to represent an array of JSON elements. Here’s an example structure of a JsonArray: [ {"name": "John Doe", "age": 35}, {"name": "Mary Jenn", "age": 41} ] On the other hand, a HashMap is a collection that stores key-value pairs ..read more
Visit website
Checking if a File is an Image in Java
Baeldung » Java
by Nam Tien Vu
4d ago
1. Overview When working with file uploads in Java, it’s crucial to ensure that the uploaded files are indeed images, especially when filenames and extensions can be misleading. In this tutorial, we’ll explore two ways to determine whether a file is an image: Checking the file’s actual content and verifying based on the file’s extension. 2. Checking File Content One of the most reliable ways to determine if a file is an image is by inspecting its content. Let’s explore two methods to do this: Using Apache Tika and then using the built-in Java ImageIO class. 2.1 Using Apache Tika mimeApache Tik ..read more
Visit website
Literal Syntax for byte[] Arrays Using Hex Notation
Baeldung » Java
by baeldung
4d ago
1. Introduction Java provides various ways to work with byte[] arrays, which are essential for handling binary data. While initializing a byte[] array with decimal values is straightforward, using hexadecimal notation can make the representation of binary data more intuitive and readable. This article will explore how to use hex notation for initializing byte[] arrays in Java, highlighting its advantages and applications. 2. Understanding byte[] Arrays In Java, a byte[] array is used to store a sequence of bytes. Each byte can hold an 8-bit signed value ranging from -128 to 127. Byte arrays ar ..read more
Visit website
Quarkus Testcontainers for Dependent Services
Baeldung » Java
by Paul Pearson
5d ago
1. Overview In this article, we’ll see the power of using Testcontainers to help test a Quarkus application using ‘live’ service-to-service testing. Testing in a microservices architecture is important and it can be difficult to reproduce a production-like system. Common options to enable testing include using manual API testing tools such as Postman, mocking services, or trusting in-memory databases. We might not perform a real service-to-service interaction until running a CI pipeline or deploying to upper environments. This can pose a problem, and delay delivery, by not thoroughly testing s ..read more
Visit website
Sort JSON Objects in Java
Baeldung » Java
by Jonathan Cook
5d ago
1. Overview JSON is a widely employed structured data format typically used in most modern APIs and data services. It’s particularly popular in web applications due to its lightweight nature and compatibility with JavaScript. Sometimes, it may be useful to sort the data before we display it in applications that fetch JSON. In this quick tutorial, we’ll see a couple of approaches for sorting JSON objects in Java. 2. Getting Started Let’s get started by defining a relatively simple JSON structure which models some imaginary Solar Events: { "solar_events": [ { "event_name ..read more
Visit website

Follow Baeldung » Java on FeedSpot

Continue with Google
Continue with Apple
OR