A collection of data structures and other utilities
In order of package names
Address (com.edavalos.mtx.util.address)
MtxAddress stores and parses US and CAN address data
DB ID Generator (com.edavalos.mtx.util.db.id)
MtxAutoIdBuilder generates IDs given a specified criteria
These are its implementations:
MtxChecksumIdGenerator- uses the Luhn algorithm to get a unique ID.MtxChecksumIterativeIdGenerator- an ordered version ofMtxChecksumIdGenerator.MtxIdGenerator- base class for generating IDs.MtxUuidGenerator- uses passed data for hashing
DB Query Generator (com.edavalos.mtx.util.db.query)
Fluent utilities to assemble SQL statements programmatically, avoiding manual string concatenation and encouraging parameterized queries.
Core capabilities include:
- builders for SELECT, INSERT, UPDATE, and DELETE statements
- WHERE clause construction with grouped conditions (AND/OR), comparisons, and IN/NOT IN
- JOIN support (INNER/LEFT/RIGHT) with ON predicates and table/column aliasing
- ORDER BY, GROUP BY, and HAVING
- LIMIT/OFFSET pagination
- parameter binding (positional or named) to help prevent injection
- safe identifier handling (table/column quoting) and configurable placeholders
- rendering to a final SQL string plus a ready-to-bind parameter list
DB Table Data Holder (com.edavalos.mtx.util.db.table)
Specialized Field Wrappers (com.edavalos.mtx.util.db.var)
Data Generation (com.edavalos.mtx.util.generator.data)
Random Data Generation (com.edavalos.mtx.util.generator.random)
MtxRandom generates a random value of most types of primitives.
These are its implementations:
MtxIpRandom- uses the IPv4 address of the machine this is running on as a seed.MtxMemRandom- uses the number of free RAM bytes of the machine this is running on as a seed.MtxTimeRandom- uses the current time (in nanoseconds) as a seed.
Graphs (com.edavalos.mtx.util.graph)
Graphs (com.edavalos.mtx.util.grouping)
Hashing (com.edavalos.mtx.util.hash)
MtxHash will securely encrypt sensitive strings. All implementations hash the values a couple of thousand times and add a salt at every iteration.
These are its implementations:
MtxSha256Hash- hashes strings with the SHA-256 algorithm. Hashes value 5,000 times.MtxSha3Hash- hashes strings with the SHA3-256 algorithm. Hashes value 2,000 times.MtxMD5Hash- hashes strings with the MD5 algorithm. Hashes value 9,000 times.MtxHashmapHash- hashes strings with the algorithm that Java hashmaps use. Hashes value 20,000 times.
Encryption (com.edavalos.mtx.util.hash.encrypt)
MtxEncryptor and MtxInsecureEncryptor will convert strings to gibberish and then convert them back to their original values.
MtxEncryptor- uses Javax.Crypto to convert strings into hashes. Slower but virtually unresolvable.MtxInsecureEncryptor- uses an encryption matrix to generate hashes. Fast, and secure for most use cases.
File Parsers (com.edavalos.mtx.util.io)
These will take care of boilerplate file scanning as well as content parsing.
Currently, these are supported:
MtxFileReader- basic scanning oftxtfiles. Will take in a filepath and provide a string array of rows.MtxCsvParser- Will take in a filepath to acsvfile and provide a 2D string array representing the matrix in the file.MtxJsonParser- Will take in a filepath to ajsonfile and provide aLinkedHashMap<String, Object>representing the json in the file.
Lists (com.edavalos.mtx.util.list)
MtxList is a general purpose list. It has four implementations:
MtxLinkedList-O(n)lookup andO(1)insertMtxArrayList-O(1)lookup andO(1)insert, but periodically expensive addsMtxHashList-O(1)lookup andO(1)insert, but periodically expensive removesMtxStringList-O(n)lookup andO(n)insert, butO(1)toString()sMtxIntrusiveLinkedList-O(n)lookup andO(1)insert, but marginally faster thanMtxLinkedList
All of these support equals() and iterator() as well as the basic functions. (size(), toArray(), sort(), etc.) See the interface for a complete list.
Stacks and Queues (com.edavalos.mtx.util.list.line)
These are simplified versions of their equivalent Java standard library implementations.
MtxStack- supportspush(),pop()andpeek()MtxQueue- supportsenqueue()anddequeue()
Both of these support size() and toString()
This is a representation (and real-world use case) of a multi-priority and bidirectional stack:
MtxElevator- controlled withqueueFloor()andmoveToNextFloor()
Maps (com.edavalos.mtx.util.map)
MtxMap is a general purpose key–value container for fast lookups with optional ordered or sorted iteration.
It includes variants to fit different needs:
- hash-backed maps — average O(1)
get()/put() - linked maps — preserves insertion order with predictable iteration
- tree-backed maps — sorted by key with O(log n)
get()/put() - array-backed maps — compact footprint, best for small collections
All of these support equals() and iterator() as well as the basic functions.
(get(), put(), remove(), containsKey(), containsValue(), keySet(), values(), entrySet(), size(), etc.)
See the interface for a complete list.
Math Utils (com.edavalos.mtx.util.math)
MtxMath holds a collection of mathematical utility classes, constants, and methods:
MtxFactorial- procedurally generates an infinite number of factorial integersMtxFibonacci- procedurally generates an infinite number of fibonacci integersMtxCatalan- procedurally generates an infinite number of catalan integersMtxStats- takes an array of numbers and calculates values with them such as mean, median, mode, standard deviation, variance, and totalPI,TAU,E,Y, andPHI- public constants holding semi-frequently used mathematical valuesisPrime()- checks if an integer is a prime numberquadraticFormulaSolver()- gets the positive x value from a quadratic equation given a, b, and ctwoDimensionArrayCopy()- copies a two dimension integer arraymin()andmax()- gets the min or max of an array or list of doubles or integers
Roman Numerals (com.edavalos.mtx.util.math)
MtxRomanNumeral converts year integers into roman numerals and roman numeral strings into year integers.
Running Total Integer Analyzer (com.edavalos.mtx.util.math)
MtxRunningTotal takes in integers (as a stream or individually) then runs calculations on the last x values.
StopWatch (com.edavalos.mtx.util.math)
MtxStopwatch begins counting when told to and marks laps or pauses / resets counter when told to as well. Core methods are:
start()- begins counting (or continues where paused)lap()- marks a lap but continues countingstop()- marks a lap and pauses countingreset()- clears all laps and resets counting to zero (but does not start counting again)getLaps()- gets all marked laps since last reset or creation
HTTP Request Reader (com.edavalos.mtx.util.network)
MtxRequestReader takes a serialized HTTP request and parses it.
Something like: GET /test/14/twelve?key1=value1&key2=value2 HTTP/1.1 would be consumed by an MtxRequestReader object to have the following properties accessible:
requestMethod:GEThttpVersion:HTTP/1.1fixedParams:["test", "14", "twelve"]anchor:nullqueryParams:key1=value1,key2=value2hasQueryParams:truehasAnchor:false
Sets (com.edavalos.mtx.util.set)
MtxSet is a general purpose set. It has six implementations:
MtxHashSet- unordered list of unique elements backed by a hash map key setMtxLinkedSet- ordered list of unique elements backed by a linked listMtxSortedLinkedSet- ordered and sorted list of unique elements backed by a linked listMtxMapSet- unordered list of unique elements backed by a tree mapMtxArraySet- unordered list of unique elements backed by a dynamic arrayMtxSortedArraySet- ordered and sorted list of unique elements backed by a dynamic array
All of these support equals() and iterator() as well as the basic functions. (contains(), toArray(), toString(), containsAll(), etc.) See the interface for a complete list.
String Handlers and Manipulators (com.edavalos.mtx.util.string)
String Utilities (com.edavalos.mtx.util.string)
A collection of helpers for inspecting, cleaning, and transforming text for everyday use.
Common tasks include:
- null/blank checks and safe comparisons (case-sensitive or case-insensitive)
- trimming and whitespace normalization (including collapsing runs of spaces/tabs)
- prefix/suffix operations to add, remove, or ensure markers
- padding and alignment for fixed-width output (left, right, center)
- case and word-style conversions (lower/upper, Title Case, camelCase, PascalCase, snake_case, kebab-case)
- splitting/joining delimited strings with sensible defaults
- bounds-safe substring and search helpers (starts/ends-with, contains)
- lightweight sanitization (strip non-printables, keep alphanumeric)
Time (com.edavalos.mtx.util.time)
MtxTime is an object for keeping a record of a time vector, with operations to modify it accordingly. It can be instantiated with a string to parse into a time, or directly with integers for each component. It will also self balance (so that its hours are no greater than 23 and its seconds and minutes are no greater than 59).
It has support for these methods:
addTime()- adds a time to this timesubtractTime()- subtracts a time from this timemultiplyBy()- multiplies this time by an integerisLongerTHan()- checks if this time vector is longer than another one
MtxClock records the time elapsed (in milliseconds) between when start() and getElapsed() is called
MtxTimeUtil provides several utilities for dealing with times:
isValidTime()- checks if a string fits the pattern used byMtxTimeextractTimeDigits()- converts a time string into an integer array of time componentsgetRelativeTimeToNow()- gets the difference between a specified time and now, in a human-readable format
MtxStopwatch begins counting when told to and marks laps or pauses / resets counter when told to as well. Core methods are:
start()- begins counting (or continues where paused)lap()- marks a lap but continues countingstop()- marks a lap and pauses countingreset()- clears all laps and resets counting to zero (but does not start counting again)getLaps()- gets all marked laps since last reset or creation
MtxTimerTask executes code asynchronously when specified for the number of times specified. Code, frequency, and delay
are specified in constructor. Methods are:
start()- begins countdown to running code, and once code is ran, manages and begins countdown for next run