Helpful Java utilities that are thoroughly tested and available on Maven Central.
This library has no dependencies on other libraries for runtime.
The.jarfile is 290K and works with JDK 1.8 through JDK 22.
The .jar file classes are version 52 (JDK 1.8)
This library is fully compatible with JPMS, commonly known as Java Modules. It includes a module-info.class file that
specifies module dependencies and exports.
This 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.
Both of these features ensure that our library can be seamlessly integrated into modular Java applications, providing robust dependency management and encapsulation.
To include in your project:
implementation 'com.cedarsoftware:java-util:2.13.0'<dependency>
<groupId>com.cedarsoftware</groupId>
<artifactId>java-util</artifactId>
<version>2.13.0</version>
</dependency>- CompactSet - A memory-efficient
Setthat expands to aHashSetwhensize() > compactSize(). - CompactLinkedSet - A memory-efficient
Setthat transitions to aLinkedHashSetwhensize() > compactSize(). - CompactCILinkedSet - A compact, case-insensitive
Setthat becomes aLinkedHashSetwhen expanded. - CompactCIHashSet - A small-footprint, case-insensitive
Setthat expands to aHashSet. - CaseInsensitiveSet - A
Setthat ignores case sensitivity forStrings. - ConcurrentSet - A thread-safe
Setnot requiring elements to be comparable, unlikeConcurrentSkipListSet. - SealableSet - Allows toggling between read-only and writable states via a
Supplier<Boolean>, managing immutability externally. - SealableNavigableSet - Similar to
SealableSetbut forNavigableSet, controlling immutability through an external supplier.
- CompactMap - A
Mapwith a small memory footprint that scales to aHashMapas needed. - CompactLinkedMap - A compact
Mapthat extends to aLinkedHashMapfor larger sizes. - CompactCILinkedMap - A small-footprint, case-insensitive
Mapthat becomes aLinkedHashMap. - CompactCIHashMap - A compact, case-insensitive
Mapexpanding to aHashMap. - CaseInsensitiveMap - Treats
Stringkeys in a case-insensitive manner. - LRUCache - Thread-safe LRU cache which implements the Map API. Supports "locking" or "threaded" strategy (selectable).
- TrackingMap - Tracks access patterns to its keys, aiding in performance optimizations.
- SealableMap - Allows toggling between sealed (read-only) and unsealed (writable) states, managed externally.
- SealableNavigableMap - Extends
SealableMapfeatures toNavigableMap, managing state externally.
- ConcurrentList - Provides a thread-safe
Listthat can be either an independent or a wrapped instance. - SealableList - Enables switching between sealed and unsealed states for a
List, managed via an externalSupplier<Boolean>.
- ArrayUtilities - Provides utilities for working with Java arrays
[], enhancing array operations. - ByteUtilities - Offers routines for converting
byte[]to hexadecimal character arrays and vice versa, facilitating byte manipulation. - ClassUtilities - Includes utilities for class-related operations. For example, the method
computeInheritanceDistance(source, destination)calculates the number of superclass steps between two classes, returning it as an integer. If no inheritance relationship exists, it returns -1. Distances for primitives and their wrappers are considered as 0, indicating no separation. - Converter - Facilitates type conversions, e.g., converting
StringtoBigDecimal. Supports a wide range of conversions. - DateUtilities - Robustly parses date strings with support for various formats and idioms.
- DeepEquals - Deeply compares two object graphs for equivalence, handling cycles and using custom
equals()methods where available. - IOUtilities - Transfer APIs, close/flush APIs, compress/uncompress APIs.
- FastReader and FastWriter - Provide high-performance alternatives to standard IO classes without synchronization.
- FastByteArrayInputStream and FastByteArrayOutputStream - Non-synchronized versions of standard Java IO byte array streams.
- EncryptionUtilities - Simplifies the computation of checksums and encryption using common algorithms.
- Executor - Simplifies the execution of operating system commands with methods for output retrieval.
- GraphComparator - Compares two object graphs and provides deltas, which can be applied to synchronize the graphs.
- MathUtilities - Offers handy mathematical operations and algorithms.
- ReflectionUtils - Provides efficient and simplified reflection operations.
- StringUtilities - Contains helpful methods for common
Stringmanipulation tasks. - SystemUtilities - Offers utilities for interacting with the operating system and environment.
- Traverser - Allows generalized actions on all objects within an object graph through a user-defined method.
- UniqueIdGenerator - Generates unique identifiers with embedded timing information, suitable for use in clustered environments.
See changelog.md for revision history.
YourKit supports open source projects with its full-featured Java Profiler. YourKit, LLC is the creator of YourKit Java Profiler and YourKit .NET Profiler, innovative and intelligent tools for profiling Java and .NET applications.
By: John DeRegnaucourt and Kenny Partlow

