LANG PACKAGE / NOTES</>↗Lang Package24 Jan 2024
The purpose of the String.strip() method in Java 11 is to remove whitespaces from both the beginning and end of a string. This is very similar to the String.trim() method available in earlier versions of Java, but there is a key difference between them. Here’s the difference: String.strip(): Introduced in Java 11, strip() uses the […]
JAVA 9 / NOTES</>↗Java 924 Jan 2024
In Java, the Map.of() factory method can be used to create an unmodifiable map of specified key-value pairs. This method is available in Java 9 and later versions. Creating a map is a bit more complicated than creating lists or sets. Because we need to provide keys and values when creating a map. When using […]
JAVA 9 / NOTES</>↗Java 924 Jan 2024
As with List.of(), in Java 9, the Set.of() factory method can be used to create an unmodifiable set of specified elements. Here is a simple example: package org.kodejava.util; import java.util.Set; public class SetOfExample { public static void main(String[] args) { Set<String> names = Set.of("Rosa", "John", "Mary", "Alice"); for (String name : names) { System.out.println(name); } […]
JAVA 9 / NOTES</>↗Java 924 Jan 2024
In Java, you can use the List.of() factory method to create an unmodifiable List consisting of specified elements. This method is available from Java 9 onwards. Here is a simple example: package org.kodejava.util; import java.util.List; public class ListOfExample { public static void main(String[] args) { List<String> names = List.of("Rosa", "John", "Mary", "Alice"); for (String name […]
ITEXT PDF / NOTES</>↗iText PDF24 Jan 2024
Creating an ordered list in iText 8 involves creating a List object and adding ListItem objects to it, similarly to creating an unordered list. For automatic numbering or bullets in a list, you’ll have to use ListNumberingType with the appropriate configuration. For example, ListNumberingType.DECIMAL for Arabic number (1, 2, 3, etc.) and ListNumberingType.ENGLISH_LOWER for English […]
ITEXT PDF / NOTES</>↗iText PDF24 Jan 2024
Creating an unordered list in iText 8 involves creating a List object and adding ListItem objects to it. Here is an example of how you can do this: package org.kodejava.itext; import com.itextpdf.layout.Document; import com.itextpdf.layout.element.List; import com.itextpdf.layout.element.ListItem; import com.itextpdf.kernel.pdf.PdfDocument; import com.itextpdf.kernel.pdf.PdfWriter; public class UnorderedListExample { public static void main(String[] args) throws Exception { P...