Lädt...


🔧 Common Java Libraries and Frameworks you Should Try


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

Java's standard Collections Framework provides a robust set of tools for managing data structures like Lists, Sets, and Maps. However, the ecosystem has expanded with various third-party libraries that provide enhanced functionality, specialized data structures, and optimized performance. This article introduces some of the most popular Java collections libraries, including Google Guava, Apache Commons Collections, Eclipse Collections, and others, each offering unique advantages and use cases. We’ll explore their key features, licensing, and "Hello World" examples to help you choose the right tool for your Java project.

1. Google Guava

Google Guava is one of the most widely used libraries in the Java ecosystem. It offers extensions to the JDK's collections framework, as well as additional utilities such as caching, concurrency utilities, string processing, and more.

  • Key Features: Collections, caching, primitives support, concurrency libraries, common annotations, string processing, and I/O utilities.
  • License: Apache 2
  • JDK Requirement: Requires JDK 1.6 or higher
  • Business-Friendly License: Yes

Example: Hello World using ImmutableList in Guava

import com.google.common.collect.ImmutableList;
public class GuavaExample {
    public static void main(String[] args) {
        ImmutableList<String> fruits = ImmutableList.of("Apple", "Banana", "Orange");
        System.out.println(fruits);
    }
}

2. Apache Commons Collections

Apache Commons Collections enhances Java’s standard collections by adding new interfaces, implementations, and utilities. It aims to improve developer productivity by providing highly reusable collection types.

  • Key Features: Extensions to JDK collections, additional utility classes, and new collection types.
  • License: Apache 2
  • Business-Friendly License: Yes

Example: Hello World with Bag in Apache Commons Collections

import org.apache.commons.collections4.Bag;
import org.apache.commons.collections4.bag.HashBag;
public class CommonsCollectionsExample {
    public static void main(String[] args) {
        Bag<String> bag = new HashBag<>();
        bag.add("Apple", 3);
        bag.add("Banana", 2);
        System.out.println(bag);
    }
}

3. Eclipse Collections

Eclipse Collections (formerly GS Collections) is a comprehensive collections framework for Java, offering JDK-compatible collection types such as Lists, Sets, and Maps. It also introduces additional types like Bags and Multimaps, with a rich API for functional-style programming.

  • Key Features: Rich API, additional types (e.g., Bags, Multimaps), JDK-compatible Lists, Sets, and Maps.
  • License: Eclipse Public License 1.0
  • Business-Friendly License: Yes

Example: Hello World using MutableList in Eclipse Collections

import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.impl.factory.Lists;
public class EclipseCollectionsExample {
    public static void main(String[] args) {
        MutableList<String> fruits = Lists.mutable.of("Apple", "Banana", "Cherry");
        System.out.println(fruits);
    }
}

4. Javatuples

Javatuples is a simple yet powerful library that provides classes for working with tuples, which are sequences of objects of different types. It supports pairs, triplets, and other tuple types.

  • Key Features: Simple tuple classes for storing heterogeneous elements.
  • License: Apache 2
  • Business-Friendly License: Yes

Example: Hello World using Triplet in Javatuples

import org.javatuples.Triplet;
public class JavatuplesExample {
    public static void main(String[] args) {
        Triplet<Integer, String, Double> triplet = new Triplet<>(1, "Apple", 2.5);
        System.out.println(triplet);
    }
}

5. Immutables

Immutables provides annotation processors that automatically generate immutable value objects. It emphasizes simplicity, safety, and consistency by eliminating boilerplate code.

  • Key Features: Generates immutable classes from annotations, reduces boilerplate code.
  • License: Apache 2
  • Business-Friendly License: Yes

Example: Hello World using Immutables

import org.immutables.value.Value;
public class ImmutablesExample {
    @Value.Immutable
    public interface Fruit {
        String name();
        int quantity();
    }

    public static void main(String[] args) {
        Fruit fruit = ImmutableFruit.builder().name("Apple").quantity(5).build();
        System.out.println(fruit);
    }
}

6. OpenHFT Chronicle Queue

OpenHFT Chronicle Queue is a high-performance, microsecond-latency messaging system that persists everything to disk, designed for high-throughput use cases.

  • Key Features: High-speed messaging with disk persistence.
  • License: GNU Lesser 3.0
  • Business-Friendly License: Yes

7. Fastutil

Fastutil extends the Java Collections Framework by providing type-specific maps, sets, and lists, with additional support for big (64-bit) data structures.

  • Key Features: Type-specific collections, big data support, optimized performance.
  • License: Apache 2
  • Business-Friendly License: Yes

8. HPPC (High-Performance Primitive Collections)

HPPC focuses on providing optimized collections for primitive types, aiming for the highest performance and memory efficiency.

  • Key Features: Collections optimized for Java primitive types, memory-efficient structures.
  • License: Apache 2
  • Business-Friendly License: Yes

9. Koloboke

Koloboke is designed for efficiency, providing Java collections that maximize memory and performance. It offers primitive-specialized collections with a focus on speed.

  • Key Features: Primitive-specialized collections, high performance.
  • License: Apache 2
  • Business-Friendly License: Yes

10. Trove

Trove provides high-performance collections for both regular and primitive data types, focusing on reducing memory footprint and enhancing processing speed.

  • Key Features: High-speed collections for primitive and regular types.
  • License: GNU Lesser 2.1
  • Business-Friendly License: Yes

11. Underscore-java

Underscore-java is a Java port of the popular Underscore.js library, offering utility functions for functional programming and data manipulation.

  • Key Features: Utility functions similar to Underscore.js, functional-style operations.
  • License: MIT
  • Business-Friendly License: Yes

GoodBye!

...

🔧 Common Java Libraries and Frameworks you Should Try


📈 55.94 Punkte
🔧 Programmierung

🔧 Rev Up Your Web Development with These Must-Try CSS Frameworks and Libraries


📈 32.57 Punkte
🔧 Programmierung

🔧 Frameworks and Libraries Used in Generative AI: A Guide for Java and Python Developers


📈 30.22 Punkte
🔧 Programmierung

🔧 Top 5 JavaScript Libraries and Frameworks Every Developer Should Know in 2024


📈 29.13 Punkte
🔧 Programmierung

🔧 30+ CSS libraries and frameworks help you style your applications efficiently.


📈 26.55 Punkte
🔧 Programmierung

🔧 Modern Web Development Frameworks: Comparing Popular Frameworks and Their Use Cases


📈 23.57 Punkte
🔧 Programmierung

🔧 15 Libraries You Should Know if You Build with React


📈 23.33 Punkte
🔧 Programmierung

🔧 💥 Top 10 JavaScript Libraries and Frameworks to Watch in 2023 💥


📈 23.24 Punkte
🔧 Programmierung

🔧 Top JavaScript Libraries and Frameworks: A Comprehensive Guide 🌈


📈 23.24 Punkte
🔧 Programmierung

🔧 10 Trending Node.js Libraries and Frameworks to Boost Your Web Development


📈 23.24 Punkte
🔧 Programmierung

🔧 Exploring Popular Go Frameworks and Libraries


📈 23.24 Punkte
🔧 Programmierung

🔧 An idea able to explain the huge amount of frameworks, libraries and programming languages out there.


📈 23.24 Punkte
🔧 Programmierung

🔧 The Role of Libraries and Frameworks in Learning to Code


📈 23.24 Punkte
🔧 Programmierung

🔧 20 Top C# Frameworks and Libraries on GitHub for Building Powerful Applications


📈 23.24 Punkte
🔧 Programmierung

🔧 List of awesome CSS frameworks, libraries and software


📈 23.24 Punkte
🔧 Programmierung

🔧 Difference between Libraries and Frameworks


📈 23.24 Punkte
🔧 Programmierung

🔧 Javascript Frameworks And Libraries


📈 23.24 Punkte
🔧 Programmierung

🔧 JavaScript frameworks: comparing the latest tools and libraries


📈 23.24 Punkte
🔧 Programmierung

🔧 Differences Between Frameworks and Libraries


📈 23.24 Punkte
🔧 Programmierung

🔧 Top 11 JavaScript Frameworks and Libraries to Learn in 2024


📈 23.24 Punkte
🔧 Programmierung

🔧 Top 10 Java Frameworks Every Developer Should Know About


📈 22.69 Punkte
🔧 Programmierung

🔧 Top 10 Java Libraries Every Developer Should Know


📈 22.36 Punkte
🔧 Programmierung

🔧 Top 10 Java Libraries Every Dev Should Know About


📈 22.36 Punkte
🔧 Programmierung

🕵️ Oracle Java SE 8u131; Java SE Embedded: 8u131 Libraries memory corruption


📈 22.13 Punkte
🕵️ Sicherheitslücken

🕵️ Oracle Java SE 7u211/8u202/11.0.2/12; Java SE Embedded: 8u201 Libraries denial of service


📈 22.13 Punkte
🕵️ Sicherheitslücken

🕵️ Oracle Java SE/JRockit/Java SE Embedded up to 5.0u51/6u60/7u40 Libraries cross site scriting


📈 22.13 Punkte
🕵️ Sicherheitslücken

🕵️ Oracle Java SE/Java SE Embedded up to 5.0u51/6u60/7u40 Libraries cross site scriting


📈 22.13 Punkte
🕵️ Sicherheitslücken

🕵️ Oracle Java SE/Java SE Embedded 7u25 Libraries cross site scriting


📈 22.13 Punkte
🕵️ Sicherheitslücken

🕵️ Oracle Java SE/Java SE Embedded up to 5.0u51/6u60/7u40 Libraries cross site scriting


📈 22.13 Punkte
🕵️ Sicherheitslücken

🕵️ Oracle Java SE/Java SE Embedded up to 5.0u51/6u60/7u40 Libraries cross site scriting


📈 22.13 Punkte
🕵️ Sicherheitslücken

matomo