{"id":13565366,"url":"https://github.com/jdereg/java-util","last_synced_at":"2026-04-20T00:14:48.769Z","repository":{"id":10489912,"uuid":"12670630","full_name":"jdereg/java-util","owner":"jdereg","description":"Rare, hard-to-write utilities that are thoroughly tested","archived":false,"fork":false,"pushed_at":"2025-03-26T16:18:34.000Z","size":8408,"stargazers_count":424,"open_issues_count":2,"forks_count":109,"subscribers_count":46,"default_branch":"master","last_synced_at":"2025-04-03T01:41:48.959Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdereg.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-09-07T19:52:43.000Z","updated_at":"2025-03-26T16:18:39.000Z","dependencies_parsed_at":"2023-10-13T20:33:41.705Z","dependency_job_id":"9edb780d-78b9-479c-9715-5395c99f2856","html_url":"https://github.com/jdereg/java-util","commit_stats":null,"previous_names":[],"tags_count":187,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdereg%2Fjava-util","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdereg%2Fjava-util/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdereg%2Fjava-util/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdereg%2Fjava-util/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdereg","download_url":"https://codeload.github.com/jdereg/java-util/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154498,"owners_count":21056539,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:01:45.479Z","updated_at":"2026-04-20T00:14:48.761Z","avatar_url":"https://github.com/jdereg.png","language":"Java","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"infographic.svg?v=3\" alt=\"java-util infographic - Essential Java Toolkit\" width=\"100%\" /\u003e\n\u003c/p\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003cp\u003e\n    \u003ca href=\"https://central.sonatype.com/search?q=java-util\u0026namespace=com.cedarsoftware\"\u003e\n      \u003cimg src=\"https://badgen.net/maven/v/maven-central/com.cedarsoftware/java-util\" alt=\"Maven Central\" height=\"20\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://www.javadoc.io/doc/com.cedarsoftware/java-util\"\u003e\n      \u003cimg src=\"https://javadoc.io/badge/com.cedarsoftware/java-util.svg\" alt=\"Javadoc\" height=\"20\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/jdereg/java-util/blob/master/LICENSE\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" alt=\"License\" height=\"20\" /\u003e\n    \u003c/a\u003e\n    \u003cimg src=\"https://img.shields.io/badge/JDK-8%20to%2024-orange\" alt=\"JDK 8–24\" height=\"20\" /\u003e\n  \u003c/p\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://github.com/jdereg/java-util\"\u003e\n      \u003cimg src=\"https://img.shields.io/github/stars/jdereg/java-util?style=social\" alt=\"GitHub stars\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/jdereg/java-util/fork\"\u003e\n      \u003cimg src=\"https://img.shields.io/github/forks/jdereg/java-util?style=social\" alt=\"GitHub forks\" /\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\nA collection of high-performance Java utilities designed to enhance standard Java functionality. These utilities focus on:\n- Memory efficiency and performance optimization\n- Thread-safety and concurrent operations\n- Enhanced collection implementations\n- Simplified common programming tasks\n- Deep object graph operations\n\nAvailable on [Maven Central](https://central.sonatype.com/search?q=java-util\u0026namespace=com.cedarsoftware).\nThis library has \u003cb\u003eno dependencies\u003c/b\u003e on other libraries for runtime.\nThe`.jar`file is `~700K` and works with `JDK 1.8` through `JDK 24`.\nThe `.jar` file classes are version 52 `(JDK 1.8)`\n\nAs of version 3.6.0 the library is built with the `-parameters`\ncompiler flag. Parameter names are now retained for tasks such as\nconstructor discovery (increased the jar size by about 10K.)\n\n---\n\n## Table of Contents\n\n- [Cloud Native \u0026 Container Ready](#cloud-native--container-ready)\n- [JDK Module Requirements](#jdk-module-requirements)\n- [Featured Utilities](#featured-utilities)\n  - [DeepEquals](#-deepequals---complete-object-comparison)\n  - [Converter](#-converter---universal-type-conversion)\n  - [TTLCache](#-ttlcache---self-cleaning-time-based-cache)\n  - [CompactMap](#-compactmap---self-optimizing-storage)\n  - [MultiKeyMap](#-multikeymap---composite-key-mapping)\n- [How java-util Compares](#how-java-util-compares)\n- [Enterprise Security Features](#-enterprise-security-features)\n  - [Input Validation \u0026 DOS Protection](#️-input-validation--dos-protection)\n  - [Dangerous Class Protection](#-dangerous-class-protection)\n  - [Cryptographic Security](#-cryptographic-security)\n  - [Network Security Controls](#-network-security-controls)\n  - [Security Audit \u0026 Monitoring](#-security-audit--monitoring)\n  - [Zero-Downtime Security Hardening](#-zero-downtime-security-hardening)\n  - [Security Compliance](#-security-compliance)\n- [Core Components](#core-components)\n- [Integration and Module Support](#integration-and-module-support)\n  - [JPMS](#jpms-java-platform-module-system)\n  - [OSGi](#osgi)\n  - [Maven and Gradle Integration](#maven-and-gradle-integration)\n  - [Framework Integration Examples](#-framework-integration-examples)\n- [Feature Options](features.md)\n- [Logging](#logging)\n- [User Guide](#user-guide)\n\n---\n\n## Cloud Native \u0026 Container Ready\n\nOptimized for modern cloud deployments and container environments:\n\n**Technical Characteristics:**\n- **Minimal Footprint**: ~700KB JAR\n- **Zero Runtime Dependencies**: No transitive dependencies to manage, reducing classpath conflicts and container image complexity\n- **Fast Startup**: JDK 8 bytecode (class file format 52) with instant classloading, optimized for serverless cold starts\n- **Thread-Safe**: All concurrent collections designed for horizontal scaling in Kubernetes and containerized environments\n- **JPMS/OSGi Support**: Works with jlink for custom JRE builds (\u003c50MB runtime), compatible with OSGi frameworks (Karaf, Felix, Equinox)\n\n**Deployment Environments:**\n- Container platforms (Docker, Kubernetes, OpenShift)\n- Serverless functions (AWS Lambda, Azure Functions, Google Cloud Functions, Cloud Run)\n- Cloud infrastructure (ECS, EKS, AKS, GKE, Fargate, App Engine)\n- Edge computing and microservices architectures\n\n**Security Benefits:**\n- Minimal attack surface with single artifact dependency tracking\n- Uses `java.util.logging` only (no Log4Shell exposure)\n- Air-gap and compliance-friendly for restricted environments\n\n## JDK Module Requirements\n\n### Required Modules\n**java.sql** - Required for date/time conversions (`java.sql.Timestamp` and `java.sql.Date`)\n- **Impact**: ~500KB footprint, includes JDBC API interfaces (no drivers required)\n- **Why**: Core `Converter` uses `java.sql.Timestamp` extensively for date/time type conversions\n- **Headless containers**: This adds ~500KB to your deployment but does NOT require database connectivity or JDBC drivers\n\n### Optional Modules (static dependencies)\n**java.xml** - Optional for `IOUtilities` XML stream operations (`javax.xml.stream.*`)\n- Only needed for XML-specific methods in `IOUtilities`\n- Most library functionality works without it\n- See `IOUtilities` javadoc for details\n\n### JPMS Module Descriptor\nWhen using java-util as a JPMS module, add to your `module-info.java`:\n```java\nrequires com.cedarsoftware.util;  // Automatically brings in java.sql\n// java.xml is marked as 'static' - not required at runtime\n```\n\n### OSGi\nThe OSGi manifest automatically imports all required packages. Optional packages (`javax.xml.stream`) are marked as optional imports.\n\n## Featured Utilities\n\n### 🚀 DeepEquals - Complete Object Comparison\n\n**What**: Compare any two Java objects for complete equality, handling all data types including cyclic references.\n\n**Why use it**:\n- ✅ Works with any objects - no equals() method needed\n- ✅ Handles circular references and complex nested structures\n- ✅ Perfect for testing, debugging, and data validation\n- ✅ Secure error messages with automatic sensitive data redaction\n- ✅ Detailed difference reporting with path to mismatch\n\n**Quick example**:\n```java\nboolean same = DeepEquals.deepEquals(complexObject1, complexObject2);\n\n// With difference reporting\nMap\u003cString, Object\u003e options = new HashMap\u003c\u003e();\nboolean same = DeepEquals.deepEquals(obj1, obj2, options);\nif (!same) {\n    String diff = (String) options.get(DeepEquals.DIFF);\n    System.out.println(\"Difference: \" + diff);\n}\n```\n\n📖 [Full documentation and options →](userguide.md#deepequals)\n\n---\n\n### 🎯 Converter - Universal Type Conversion\n\n**What**: Convert between many Java types with a single API - no more scattered conversion logic.\n\n**Why use it**:\n- ✅ ~1800 type conversions out of the box (use `.allAllSupportedConversions()` to list them out)\n- ✅ Extensible - add your own custom conversions\n- ✅ Handles complex types including temporal, arrays, and collections\n\n**Quick example**:\n```java\nDate date = Converter.convert(\"2024-01-15\", Date.class);\nLong number = Converter.convert(\"42.7\", Long.class);  // Returns 43\n```\n\n📖 [Full documentation and conversion matrix →](userguide.md#converter)\n\n---\n\n### ⏰ TTLCache - Self-Cleaning Time-Based Cache\n\n**What**: A thread-safe cache that automatically expires entries after a time-to-live period, plus includes full LRU capability.\n\n**Why use it**:\n- ✅ Automatic memory management - no manual cleanup needed\n- ✅ Prevents memory leaks from forgotten cache entries\n- ✅ Perfect for session data, API responses, and temporary results\n\n**Quick example**:\n```java\nTTLCache\u003cString, User\u003e userCache = new TTLCache\u003c\u003e(5, TimeUnit.MINUTES);\nuserCache.put(\"user123\", user);  // Auto-expires in 5 minutes\nUser cached = userCache.get(\"user123\");  // Returns user or null if expired\n```\n\n📖 [Full documentation and configuration →](userguide.md#ttlcache)\n\n---\n\n### 🔄 CompactMap - Self-Optimizing Storage\n\n**What**: A Map implementation that automatically switches between compact and traditional storage based on size.\n\n**Why use it**:\n- ✅ Significant memory reduction for small maps (under ~60 elements)\n- ✅ Automatically scales up for larger datasets\n- ✅ Drop-in replacement for HashMap - no code changes needed\n\n**Quick example**:\n```java\nMap\u003cString, Object\u003e map = new CompactMap\u003c\u003e();  // Starts compact\nmap.put(\"key\", \"value\");  // Uses minimal memory\n// Automatically expands when needed - completely transparent\n```\n\n📖 [Full documentation and benchmarks →](userguide.md#compactmap)\n\n---\n\n### 🔑 MultiKeyMap - Composite Key Mapping\n\n**What**: Index objects with unlimited keys (decision variables). Useful for pricing tables, configuration trees, decision tables, arrays and collections as keys, matrix as key. \n\n**Why use it**:\n- ✅ Composite keys without ceremony – Stop gluing keys into strings or writing boilerplate Pair/wrapper classes.\n- ✅ Real-world key shapes – Use arrays, collections, jagged multi-dimensional arrays, matrices/tensors, etc., as key components; deep equality \u0026 hashing mean “same contents” truly equals “same key.”\n- ✅ Cleaner, safer code – No more hand-rolled equals()/hashCode() on ad-hoc key objects. Fewer collision bugs, fewer “why doesn’t this look up?” moments.\n- ✅ Beats nested maps – One structure instead of Map\u003cA, Map\u003cB, V\u003e\u003e. Simpler reads/writes, simpler iteration, simpler mental model.\n- ✅ Follows same concurrency semantics as ConcurrentHashMap.\n- ✅ Map-like ergonomics – Familiar put/get/contains/remove semantics; drop-in friendly alongside the rest of java.util collections.\n- ✅ Fewer allocations – Avoid creating short-lived wrapper objects just to act as a key; reduce GC pressure versus “make-a-key-object-per-call.”\n- ✅ Better iteration \u0026 analytics – Iterate entries once; no nested loops to walk inner maps when you just need all (k1,k2,…,v) tuples.\n- ✅ Easier indexing patterns – Natural fit for multi-attribute lookups (e.g., (tenantId, userId), (type, region), (dateBucket, symbol)).\n- ✅ Configurable case-insensitivity (case-retaining) – opt in to case-insensitive matching where you want it, keep exact matching where you don’t—all while preserving original casing for display/logging.\n\n**Quick examples**:\n\nExample 1 — Composite key that includes a small jagged array\n```java\n// Composite key: [[1, 2], \"some key\"]  -\u003e value\nMultiKeyMap\u003cString\u003e map = new MultiKeyMap\u003c\u003e();\n\nObject[] compositeKey = new Object[] { new int[]{1, 2}, \"some key\" };\nmap.put(compositeKey, \"payload-123\");\n\n// Retrieve using a *new* array with the same contents (deep equality)\nString v1 = map.get(compositeKey);  // v1 = \"payload-123\"\n\n// Standard Map operations work with the composite array key\nboolean present = map.containsKey(compositeKey);   // true\nmap.remove(compositeKey);\nmap.containsKey(compositeKey); // false\n```\nExample 2 — Var-args style (no ambiguity with Map.put/get)\n```java\n// Var-args API: putMultiKey(value, k1, k2, k3) and getMultiKey(k1, k2, k3)\n// Use this when you already have the distinct keys in hand.\nMultiKeyMap\u003cString\u003e map = new MultiKeyMap\u003c\u003e();\n\nString tenantId = \"acme\";\nlong userId = 42L;\nString scope = \"read:invoices\";\n\n// Value first by design (var-args must be last)\nmap.putMultiKey(\"granted\", tenantId, userId, scope);\n\nString perm = map.getMultiKey(tenantId, userId, scope);\nSystem.out.println(perm); // prints: granted\n\nboolean ok = map.containsMultiKey(tenantId, userId, scope);\nSystem.out.println(ok); // true\n\nmap.removeMultiKey(tenantId, userId, scope);\nSystem.out.println(map.containsMultiKey(tenantId, userId, scope)); // false\n```\n\n📖 [Full documentation and use cases →](userguide.md#multikeymap)\n\n---\n\n### 🎁 Plus Many More Utilities\n\nFrom reflection helpers to graph traversal, concurrent collections to date utilities - java-util has you covered. [Browse all utilities →](#core-components)\n\n**Why developers love these utilities:**\n- **Zero dependencies** - No classpath conflicts\n- **Null-safe** - Handle edge cases gracefully  \n- **High performance** - Optimized for real-world usage\n- **JDK 8+ compatible** - Works everywhere\n- **Production proven** - Used in high-scale applications\n\n## How java-util Compares\n\n| Feature | JDK Collections | Google Guava | Eclipse Collections | Apache Commons | **java-util**                 |\n|---------|----------------|--------------|---------------------|----------------|-------------------------------|\n| **Dependencies** | None | 3+ libraries | 2+ libraries | Multiple | None                          |\n| **Jar Size** | N/A | ~2.7MB | ~2.8MB | ~500KB each | ~700KB total                  |\n| **JDK Compatibility** | 8+ | 11+ (latest) | 11+ | 8+ | 8+                            |\n| **Null-Safe Concurrent** | ❌ | ❌ | ❌ | ❌ | ✅ ConcurrentMapNullSafe       |\n| **Memory-Adaptive Collections** | ❌ | ❌ | ✅ | ❌ | ✅ CompactMap/Set              |\n| **Case-Preserving Maps** | ❌ | ❌ | ❌ | Limited | ✅ Retains original case       |\n| **Universal Type Conversion** | ❌ | Limited | ❌ | Limited | ✅ ~1800 conversions           |\n| **N-Dimensional Mapping** | ❌ | ⚠️ Table (2D only) | ❌ | ⚠️ Limited | ✅ MultiKeyMap (unlimited N-D) |\n| **Deep Object Comparison** | ❌ | Limited | ❌ | ❌ | ✅ Handles cycles              |\n| **Runtime Configuration** | ❌ | ❌ | ❌ | ❌ | ✅ 70+ feature options         |\n| **TTL Caching** | ❌ | ✅ | ❌ | ❌ | ✅ + LRU combo                 |\n| **Thread-Safe with Nulls** | ❌ | ❌ | ❌ | ❌ | ✅ All concurrent types        |\n| **JPMS/OSGi Ready** | ✅ | ⚠️ | ✅ | ⚠️ | ✅ Pre-configured              |\n| **Security Controls** | ❌ | ❌ | ❌ | ❌ | ✅ Input validation            |\n\n### Key Differentiators\n\n**🎯 Zero Dependencies**: Unlike Guava (Checker Framework, Error Prone, J2ObjC) or Eclipse Collections (JUnit, SLF4J), java-util has zero runtime dependencies - no classpath conflicts ever.\n\n**🔒 Null-Safe Concurrency**: java-util is the only library providing thread-safe collections that handle null keys and values safely (`ConcurrentHashMapNullSafe`, `ConcurrentSetNullSafe`).\n\n**🧠 Smart Memory Management**: `CompactMap` and `CompactSet` automatically adapt from array-based storage (small size) to hash-based storage (large size) - optimal memory usage at every scale.\n\n**🔄 Universal Conversion**: Convert between any meaningful Java types - primitives, collections, dates, enums, custom objects. Other libraries require multiple dependencies to achieve the same coverage.\n\n**⚙️ Production Flexibility**: 70+ runtime configuration options allow zero-downtime security hardening and environment-specific tuning that enterprise applications demand.\n\n## 🔒 Enterprise Security Features\n\njava-util provides comprehensive security controls designed for enterprise environments where security compliance and threat mitigation are critical:\n\n### 🛡️ Input Validation \u0026 DOS Protection\n\n**Configurable Resource Limits:**\n```java\n// Prevent memory exhaustion attacks\nSystem.setProperty(\"deepequals.max.collection.size\", \"1000000\");\nSystem.setProperty(\"stringutilities.max.repeat.total.size\", \"10485760\");\nSystem.setProperty(\"mathutilities.max.array.size\", \"1000000\");\n\n// Protect against ReDoS (Regular Expression Denial of Service)\nSystem.setProperty(\"dateutilities.regex.timeout.enabled\", \"true\");\nSystem.setProperty(\"dateutilities.regex.timeout.milliseconds\", \"1000\");\n```\n\n### 🚫 Dangerous Class Protection\n\n**Block Access to Sensitive System Classes:**\n```java\n// Prevent reflection-based attacks\nSystem.setProperty(\"reflectionutils.dangerous.class.validation.enabled\", \"true\");\n// Blocks: Runtime, ProcessBuilder, System, Unsafe, ScriptEngine\n\n// Prevent sensitive field access\nSystem.setProperty(\"reflectionutils.sensitive.field.validation.enabled\", \"true\");  \n// Blocks: password, secret, apikey, credential fields\n```\n\n### 🔐 Cryptographic Security\n\n**Enforce Strong Crypto Parameters:**\n```java\n// PBKDF2 iteration requirements\nSystem.setProperty(\"encryptionutilities.min.pbkdf2.iterations\", \"100000\");\nSystem.setProperty(\"encryptionutilities.max.pbkdf2.iterations\", \"1000000\");\n\n// Salt and IV size validation\nSystem.setProperty(\"encryptionutilities.min.salt.size\", \"16\");\nSystem.setProperty(\"encryptionutilities.min.iv.size\", \"12\");\n```\n\n### 🌐 Network Security Controls\n\n**Protocol and Host Validation:**\n```java\n// Restrict allowed protocols\nSystem.setProperty(\"io.allowed.protocols\", \"https\");\nSystem.setProperty(\"urlutilities.allowed.protocols\", \"https\");\n\n// Prevent SSRF (Server-Side Request Forgery)\nSystem.setProperty(\"urlutilities.allow.internal.hosts\", \"false\");\nSystem.setProperty(\"urlutilities.max.download.size\", \"104857600\"); // 100MB limit\n```\n\n### 🔍 Security Audit \u0026 Monitoring\n\n**Comprehensive Logging:**\n```java\n// Enable detailed security logging\nSystem.setProperty(\"io.debug\", \"true\");\nSystem.setProperty(\"io.debug.detailed.urls\", \"true\");\nSystem.setProperty(\"io.debug.detailed.paths\", \"true\");\n```\n\n### 🏢 Zero-Downtime Security Hardening\n\n**Production-Safe Configuration:**\n- **Feature flags**: Enable/disable security features without code changes\n- **Gradual rollout**: Test security features in staging before production\n- **Environment-specific**: Different limits for dev/staging/production\n- **Compliance ready**: Meet OWASP, SOC 2, ISO 27001 requirements\n\n**Example: Progressive Security Enablement**\n```bash\n# Development (permissive)\n-Dreflectionutils.security.enabled=false\n\n# Staging (warning mode)  \n-Dreflectionutils.security.enabled=true\n-Dreflectionutils.dangerous.class.validation.enabled=false\n\n# Production (full security)\n-Dreflectionutils.security.enabled=true\n-Dreflectionutils.dangerous.class.validation.enabled=true\n-Dreflectionutils.sensitive.field.validation.enabled=true\n```\n\n### 📋 Security Compliance\n\n| Security Standard | java-util Coverage |\n|-------------------|-------------------|\n| **OWASP Top 10** | ✅ Injection prevention, DoS protection, Logging |\n| **CWE Mitigation** | ✅ CWE-22 (Path traversal), CWE-502 (Unsafe deserialization) |\n| **NIST Guidelines** | ✅ Input validation, Crypto parameter enforcement |\n| **SOC 2 Type II** | ✅ Audit logging, Access controls, Data protection |\n\n\u003e **Default Secure**: All security features are disabled by default for backward compatibility, but can be enabled system-wide with zero code changes.\n\n## Core Components\n\n\u003ctable\u003e\n\u003ctr style=\"background-color: #334155;\"\u003e\n\u003cth style=\"color: #ffffff; font-weight: bold; padding: 8px;\"\u003eComponent\u003c/th\u003e\n\u003cth style=\"color: #ffffff; font-weight: bold; padding: 8px;\"\u003eDescription\u003c/th\u003e\n\u003c/tr\u003e\n\u003ctr style=\"background-color: #f0f4f8;\"\u003e\n\u003ctd style=\"color: #334155; font-weight: bold;\"\u003e\u003cstrong\u003eSets\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#compactset\"\u003eCompactSet\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eMemory-efficient Set that dynamically adapts its storage structure based on size.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#caseinsensitiveset\"\u003eCaseInsensitiveSet\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eSet implementation with case-insensitive \u003ccode\u003eString\u003c/code\u003e handling.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#concurrentset\"\u003eConcurrentSet\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eThread-safe Set supporting null elements.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#concurrentnavigablesetnullsafe\"\u003eConcurrentNavigableSetNullSafe\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eThread-safe \u003ccode\u003eNavigableSet\u003c/code\u003e supporting null elements.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#identityset\"\u003eIdentitySet\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eHigh-performance Set using object identity (\u003ccode\u003e==\u003c/code\u003e) instead of \u003ccode\u003eequals()\u003c/code\u003e. Faster than \u003ccode\u003eCollections.newSetFromMap(new IdentityHashMap\u003c\u003e())\u003c/code\u003e.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#classvalueset\"\u003eClassValueSet\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eHigh-performance Set optimized for fast \u003ccode\u003eClass\u003c/code\u003e membership testing using JVM-optimized \u003ccode\u003eClassValue\u003c/code\u003e.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#intervalset\"\u003eIntervalSet\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eThread-safe interval set with O(log n) performance, automatically merges intervals, smart boundary handling for 20+ types, and you can add your own.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr style=\"background-color: #f0f4f8;\"\u003e\n\u003ctd style=\"color: #334155; font-weight: bold;\"\u003e\u003cstrong\u003eMaps\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#compactmap\"\u003eCompactMap\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eMemory-efficient Map that dynamically adapts its storage structure based on size.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#caseinsensitivemap\"\u003eCaseInsensitiveMap\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eA \u003ccode\u003eMap\u003c/code\u003e wrapper that provides case-insensitive, case-retentive keys and inherits the features of the wrapped map (e.g., thread-safety from \u003ccode\u003eConcurrentMap\u003c/code\u003e types, multi-key support from \u003ccode\u003eMultiKeyMap\u003c/code\u003e, sorted, thread-safe, allow nulls from \u003ccode\u003eConcurrentNavigableMapNullSafe\u003c/code\u003e).\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#lrucache\"\u003eLRUCache\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eThread-safe Least Recently Used cache with configurable eviction strategies.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#ttlcache\"\u003eTTLCache\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eThread-safe Time-To-Live cache with optional size limits.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#trackingmap\"\u003eTrackingMap\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eA \u003ccode\u003eMap\u003c/code\u003e wrapper that tracks key access. Inherits features from wrapped \u003ccode\u003eMap\u003c/code\u003e, including thread-safety (\u003ccode\u003eConcurrentMap\u003c/code\u003e types), sorted, thread-safe, with null support (\u003ccode\u003eConcurrentNavigableMapNullSafe\u003c/code\u003e)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#concurrenthashmapnullsafe\"\u003eConcurrentHashMapNullSafe\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eThread-safe \u003ccode\u003eHashMap\u003c/code\u003e supporting null keys and values.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#concurrentnavigablemapnullsafe\"\u003eConcurrentNavigableMapNullSafe\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eThread-safe \u003ccode\u003eNavigableMap\u003c/code\u003e supporting null keys and values.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#classvaluemap\"\u003eClassValueMap\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eHigh-performance Map optimized for fast \u003ccode\u003eClass\u003c/code\u003e key lookups using JVM-optimized \u003ccode\u003eClassValue\u003c/code\u003e.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#multikeymap\"\u003eMultiKeyMap\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eConcurrent map supporting multiple keys.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr style=\"background-color: #f0f4f8;\"\u003e\n\u003ctd style=\"color: #334155; font-weight: bold;\"\u003e\u003cstrong\u003eLists\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#concurrentlist\"\u003eConcurrentList\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eHigh-performance bucket-based concurrent \u003ccode\u003eList\u003c/code\u003e and \u003ccode\u003eDeque\u003c/code\u003e with lock-free operations.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr style=\"background-color: #f0f4f8;\"\u003e\n\u003ctd style=\"color: #334155; font-weight: bold;\"\u003e\u003cstrong\u003eUtilities\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#arrayutilities\"\u003eArrayUtilities\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eComprehensive array manipulation operations.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#byteutilities\"\u003eByteUtilities\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eByte array and hexadecimal conversion utilities.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#classutilities\"\u003eClassUtilities\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eClass relationship and reflection helper methods.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#converter\"\u003eConverter\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eAn extensive and extensible conversion utility with thousands of built-in transformations between common JDK types (Dates, Collections, Primitives, EnumSets, etc.).\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#dateutilities\"\u003eDateUtilities\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eAdvanced date parsing and manipulation.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#datageneratorinputstream\"\u003eDataGeneratorInputStream\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eMemory-efficient \u003ccode\u003eInputStream\u003c/code\u003e for generating test data on-the-fly with multiple generation modes (random, sequential, patterns, custom).\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#deepequals\"\u003eDeepEquals\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eRecursive object graph comparison.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#encryptionutilities\"\u003eEncryptionUtilities\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eSimplified encryption and checksum operations.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#executor\"\u003eExecutor\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eStreamlined system command execution.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#graphcomparator\"\u003eGraphComparator\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eObject graph difference detection and synchronization.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#ioutilities\"\u003eIOUtilities\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eEnhanced I/O operations and streaming utilities.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#mathutilities\"\u003eMathUtilities\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eExtended mathematical operations.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#reflectionutils\"\u003eReflectionUtils\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eOptimized reflection operations.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#regexutilities\"\u003eRegexUtilities\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eSafe regex operations with ReDoS protection, pattern caching, and timeout enforcement.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#stringutilities\"\u003eStringUtilities\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eExtended \u003ccode\u003eString\u003c/code\u003e manipulation operations.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#systemutilities\"\u003eSystemUtilities\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eSystem and environment interaction utilities.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#traverser\"\u003eTraverser\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eConfigurable object graph traversal.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#typeutilities\"\u003eTypeUtilities\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eAdvanced Java type introspection and generic resolution utilities.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"userguide.md#uniqueidgenerator\"\u003eUniqueIdGenerator\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eDistributed-safe unique identifier generation.\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## Integration and Module Support\n\n### JPMS (Java Platform Module System)\n\nThis library is fully compatible with JPMS, commonly known as Java Modules. It includes a `module-info.class` file that \nspecifies module dependencies and exports. \n\n### OSGi\n\nThis library also supports OSGi environments. It comes with pre-configured OSGi metadata in the `MANIFEST.MF` file, ensuring easy integration into any OSGi-based application.\n\n### Using in an OSGi Runtime\n\nThe jar already ships with all necessary OSGi headers and a `module-info.class`. No `Import-Package` entries for `java.*` packages are required when consuming the bundle.\n\nTo add the bundle to an Eclipse feature or any OSGi runtime simply reference it:\n\n```xml\n\u003cplugin id=\"com.cedarsoftware.java-util\" version=\"LATEST_VERSION\"/\u003e\n```\n\nBoth of these features ensure that our library can be seamlessly integrated into modular Java applications, providing robust dependency management and encapsulation.\n\n### Maven and Gradle Integration\n\nTo include in your project:\n\u003e Replace `LATEST_VERSION` with the version shown here:\n[![Maven Central](https://img.shields.io/maven-central/v/com.cedarsoftware/java-util)](https://central.sonatype.com/artifact/com.cedarsoftware/java-util)\n\n##### Gradle\n```groovy\nimplementation 'com.cedarsoftware:java-util:LATEST_VERSION'\n```\n\n##### Maven\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.cedarsoftware\u003c/groupId\u003e\n  \u003cartifactId\u003ejava-util\u003c/artifactId\u003e\n  \u003cversion\u003eLATEST_VERSION\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### 🚀 Framework Integration Examples\n\nFor comprehensive framework integration examples including Spring, Jakarta EE, Spring Boot Auto-Configuration, Microservices, Testing, and Performance Monitoring.\n\nKey integrations include:\n- **[Spring Framework](frameworks.md#spring-framework-integration)** - Configuration beans and case-insensitive property handling\n- **[Jakarta EE/JEE](frameworks.md#jakarta-ee--jee-integration)** - CDI producers and validation services\n- **[Spring Boot](frameworks.md#spring-boot-auto-configuration)** - Auto-configuration with corrected cache constructors\n- **[Microservices](frameworks.md#microservices--cloud-native)** - Service discovery and cloud-native configuration\n- **[Testing](frameworks.md#testing-integration)** - Enhanced test comparisons with DeepEquals\n- **[Monitoring](frameworks.md#performance-monitoring-integration)** - Micrometer metrics integration\n\n## Feature Options\n\njava-util provides **70+ runtime configuration options** via system properties, enabling:\n\n- **Zero-downtime security hardening** - Enable security features without code changes\n- **Environment-specific tuning** - Different limits for development vs. production\n- **Gradual rollout strategies** - Test new security features with feature flags\n- **Compliance flexibility** - Meet varying regulatory requirements across deployments\n\nAll security features are **disabled by default** for backward compatibility.\n\n📖 **[View complete feature options reference →](features.md)**\n\n### Logging\n\nBecause `java-util` has no dependencies on other libraries, `java-util` uses the Java built-in `java.util.logging` for all output. See the\n[user guide](userguide.md#redirecting-javautillogging) for ways to route\nthese logs to SLF4J or Log4j\u0026nbsp;2.\n\n### User Guide\n[View detailed documentation on all utilities.](userguide.md)\n\nSee [changelog.md](/changelog.md) for revision history.\n","funding_links":[],"categories":["Java","工具库","Projects"],"sub_categories":["Utility"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdereg%2Fjava-util","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdereg%2Fjava-util","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdereg%2Fjava-util/lists"}