Lucene MMapDirectory and ByteBuffersDirectory Example
In Lucene, ByteBuffersDirectory is for pure in-memory access for demos, and MMapDirectory uses memory-mapped files stored in the filesystem.
In Lucene, ByteBuffersDirectory is for pure in-memory access for demos, and MMapDirectory uses memory-mapped files stored in the filesystem.
Spring AI provides 3 inbuilt classes MapOutputConverter, ListOutputConverter, and BeanOutputConverter to help prompt in communicating expected response structures.
This Spring tutorial discusses the basics of Spring AI APIs for image generation using OpenAI’s DALL-E and Stability AI with examples.
This Spring AI tutorial discusses its core terminology and examples to interact with OpenAI’s chat and image generation APIs using simple text prompts.
Learn to write SQL queries with ‘LIKE’ keyword in a Spring Boot JPA application and execute with JdbcClient, JdbcTemplate or JpaRepository template methods.
Learn to create a REST API controller using @RestController in a Spring Boot application, and add method validation, error handling and unit tests.
Learn to Spring Data JPA module and work with JpaRepository interface for performing the CRUD operations in underlying databases in a Spring Boot application.
When rebuilding a Java or Spring application, after upgrading Java 21, you may face the issue “NoSuchFieldError: Class JCTree$JCImport does not have member field”.
Learn to filter a Map by keys or values or both, using the Java 8 Stream filter() and collect() methods with examples.
Learn to create a Java Stream utility class with contains(), containsAll() or containsAny() methods and learn to use them with examples.
Java Stream API provides excellent filtering capability on the elements in the Stream. Sometimes, the stream elements also contain the nested collections; we need to filter those elements in the nested collections. This Java tutorial discusses various approaches with examples to apply filtering on nested collections and collecting the filtered …
Stream mapMulti() is a specialized form of the map() method that transforms each element of a stream into one or multiple output elements or none at all.
Learn to use Java 8 LocalDate and TemporalAdjusters class to get the first and the last day of the current week, month or year with examples.
This short Java tutorial lists two ready-to-use snippets for invoking the default methods in an interface without implementing the interface in a class.
In Java, an identity string is a unique identifier associated with an object instance without calling the overridden toString() or hashCode() methods.
Learn to check if a string starts with, ends with, or both with a specified substring using the regex and built-in methods, and array slicing.
Since Java 8, the java.util.Base64 class provides convenient methods for encoding and decoding files such as text, image, JSON files.
Learn to initialize Java HashMap object in different ways such as empty map, pre-populated map, and collecting stream elements into the map.
In TypeScript, method overriding allows derived classes to provide a specific implementation for a method that is already defined in a base class.
For each interface, we must write a custom XmlAdapter class that handles the conversion between the value in Java Object and XML string.
In any programming language, naming conventions are a very important best practice to follow. Different parts of a program are written in specific cases so they can communicate easily their purpose in the source code. This short article lists some popular casings such as camel case, pascal case, snake case, …
Learn to solve the error “No default constructor found” when unmarshaling an XML to Java object using JAXB @XmlTransient and @XmlJavaTypeAdapter annotations.
Java 8 Optional contains orElse() and orElseGet() methods that return a default value when the optional is empty. Learn the difference between both.
TypeScript examples to create of objects that adhere to interface definitions, without requiring explicit class implementations.
TypeScript instanceof operator checks the type of an object at runtime. Learn to use it with a class, interface, or even an array with examples.
Learn the differences between a class and an interface in Typescript including syntax, extensibility, usage and code after compilation with examples.
In this TypeScript tutorial, we will learn about generic interfaces, classes, and methods and explore their syntax, usage, and benefits.
Learn to create derived interfaces, in TypeScript, by extending a single or multiple interfaces, interface merging, and intersection types with examples.
Learn the basics of creating an interface, adding fields (optional and read-only) and methods, and implementing an interface in another object with examples.
Learn to write Spring Boot RESTs that help in downloading the Excel files (.xlsx) either stored in the server or generating and then sending it.
Learn to split a string in Python from the basic split() method to more advanced approaches such as splitlines() and regex module with examples.
Learn to create generic and custom error pages for specific HTTP error codes in a Spring Boot application with configuration examples.
By leveraging Spring @Import and @ImportResource annotations, we can create more modular, maintainable, and flexible Spring Boot applications.
Spring Boot provides various ways to load property files such as default application.properties, spring profiles, custom property files, environment variables, and system properties.
Learn to create a Spring Boot project with Gradle from scratch, configure the build script, create a Spring Boot application class, and run the application.
Python filter() function provides a concise and readable way to filter elements from a list based on a specified condition. Learn with examples.
Learn to find the most frequent elements in a List or Array using Python that offers several efficient methods to find the most common items
Learn to remove duplicates from a python sequence or list while preserving the original order of the elements using seen set, OrderedDict, Numpy and Pandas.
Python multidict (or multi-dictionary) is a data structure that extends the capabilities of a regular dictionary and allows multiple values for the same key.
This Python tutorial explores different methods to find the largest or smallest N items using built-in sorting, heapq module, and NumPy library.
This tutorial will explore different methods to keep the last N items using the deque from the collections module, standard Python lists, NumPy arrays, and strings.
In this Java tutorial, learn the different approaches for calculating the number of weeks between two dates using the Java Date and Time API.
In this Java tutorial, we will explore various methods to display the name of the day of the week, catering to different scenarios and requirements. Note that we should be careful of using the int values assigned to weekdays as they differ from method to method. 1. Display the Day …
In this Java date-time tutorial, we’ll explore how to split a date-time range into equal intervals. Conceptually, splitting a date-time range into equal intervals involves dividing the entire range into smaller, equally-sized sub-ranges. In short, we need to determine the start and end points of each sub-range. 1. Splitting Date-time …
Learn to implement and use a StopWatch in Java with a custom implementation for simple uses and Apache Commons StopWatch class for advanced uses.
Learn to calculate the elapsed time since midnight (in seconds or milliseconds) using Java 8 classes such as LocalTime, LocalDateTime and ZonedDateTime.
Learn to use new Java 8 APIs to obtain the current quarter, the quarter from a given date and the start and end date of a quarter.
Learn to get the Month information in either number or name, and to convert it into another using Java Date-time API and simple examples.
Since Java 16, we can use the additional parameter [B] to format a date-time object with the date-time information using the DateTimeFormatter class.
Beginning Java 18, we can use Math.divideExact() method that throws an ArithmeticException if the result overflows. Learn with example.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.