Learnitweb

Author: Editorial Team

  • Concurrency vs Parallelism

    1. Introduction At first, concurrency and parallelism may seem to be the same thing but actually these are different. In Java programming, understanding the concepts of concurrency and parallelism is important for developing efficient and robust applications. Java with its libraries and features provide rich support to both concurrency and parallelism. A simple example of…

  • Improved Docker Container Integration with Java 10

    1. Introduction Java during startup normally queries the operating system to setup runtime defaults such as the number of GC threads and default memory limits. When running in a container, the operating functions used to get information provide information about the host and do not provide information about the container configuration and limits. With the…

  • Class Data sharing

    1. Introduction Class data sharing (CDS) helps reduce the startup time for Java programming language applications, particularly in smaller applications. CDS helps reducing memory footprint between multiple Java Virtual Machines (JVM). When the JRE is installed using the installer, the installer loads a set of classes from the system jar file into a private internal…

  • Create unmodifiable copy using copyOf method

    1. Introduction In Java 10, the Set.copyOf, List.copyOf, Map.copyOf static factory methods provide a convenient way to create unmodifiable collections (Set, List and Map). A collection is considered as unmodifiable if elements cannot be added, modified or removed. An unmodifiable collection hold the same data as long as the reference exists to the collection. The…

  • Optional.orElseThrow()

    1. Introduction A container object which may or may not contain a non-null value. If a value is present, isPresent() returns true. If no value is present, the object is considered empty and isPresent() returns false. Optional has a method get() which return a value if the value is present, otherwise throws NoSuchElementException. The common…

  • Java 10 Local Variable Type Inference

    1. Introduction Before discussing local variable type inference, let us review what is type inference in Java. Following is the way of declaring a list of String in Java. The compiler inferences the type of list be looking at the left hand side of the =. Let us see another example of type inference. Let…

  • Java 9 process API updates

    1. Introduction Until Java 8, Java SE provided limited support for native operative-system processes. This forced developers to resort to native code. Also, programmers have to write code based on operating system. To solve this issue, serval process API enhancements were introduced in Java 9. The java.lang.Process class is enhanced to operating specific id of…

  • The guide to jlink in Java

    1. Introduction The jlink tool is used to link a set of modules, along with their transitive dependencies, to create a custom runtime image. The jlink enables you to generate a custom runtime image that contains only the required platform modules for an application. You can use the jlink tool to assemble and optimize a…

  • Aggregator module in Java

    1. Introduction Sometimes there is requirement to group related modules so that these can be read as a group. Else, each module needs to be read individually. That is why it is better to group related modules. We can group the related common modules in a single module, and we can read this module directly.…

  • Module resolution and module path

    1. Introduction Before Java 9, the scan of the whole classpath was required to search for a type. The classpath is a flat list of types. In Java 9, the modules are resolved from module path which contains only modules. The Java runtime and compiler are able to look for the module in the module…