When using collections in Java it’s conventional to use the interface types for our variables and fields, rather than the concrete types. We look at the difference between these two approaches.
Search Results for: list
Set List of Objects in Swagger API Response
Learn how to modify the Swagger API response to deliver a list of objects.
List All the Classes Loaded in the JVM
Learn different techniques to list all classes loaded in the JVM
Collecting Stream Elements into a List in Java
Learn how to collect Stream elements into a List in different versions of Java, and the pros and cons of the approaches.
Display Custom Items in JavaFX ListView
Explore a way to show custom items in JavaFX ListView.
Guava’s Futures and ListenableFuture
Learn about Guava’s support in async programming: Futures and ListenableFuture
How to Convert Mono<List<T>> Into Flux<T>
Learn to convert a Mono of a collection to Flux of the collection’s items.
Get List of JSON Objects with WebClient
Learn how to convert a JSON Array into a Java Array of Object, Array of POJO, and a List of POJO using Spring WebClient
Get list of JSON objects with Spring RestTemplate
Spring RestTemplate can convert a JSON array to a variety of Java types. We look at the options and how to produce a type-specific list.
ArrayList vs. LinkedList vs. HashMap in Java
Learn about the differences between three of the most common Java Collections: ArrayList, LinkedList, and HashMap
The Capacity of an ArrayList vs the Size of an Array in Java
The capacity of an ArrayList functions differently to the size of an Array. We explore the differences and when it’s a good idea to set an ArrayList’s size.
Get a List of Trusted Certificates in Java
Learn how to read a list of trusted certificates in Java through quick and practical examples
Reversing a Linked List in Java
Implement two linked list reversal algorithms in Java
Listing the Available Cipher Algorithms
Let’s take a look at how we can list the available cipher algorithms.
Arrays.asList vs new ArrayList(Arrays.asList())
They may look very similar but they aren’t. Let’s explore why.
Assert Two Lists for Equality Ignoring Order in Java
Learn how to make order agnostic comparison of lists when writing unit tests.
List All Classes Loaded in a Specific Class Loader
List all the classes loaded by a specific class loader in Java
Finding the Differences Between Two Lists in Java
We investigate how to finding elements present in one list, but not in another, including lists with multiple copies of the same element.
Converting List to Map With a Custom Supplier
Learn several ways to convert a List into a Map using Custom Suppliers.
Convert an Array of Primitives to a List
Learn how to convert an array of primitives to a List of objects of the corresponding type.