
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Generic sorting (TIMsort variant) for sorting multiple arrays or collections by one, or any data structure a Swapper can be implemented for (split off from util-collections)
Miscellaneous general-purpose utilities useful in many types of project.
Everything here is available from Maven Central under com.mastfrog:$PROJECTNAME
.
bits
- API-compatible BitSet-like classes which can wrap Java BitSets (or not), which work as a drop-in replacement and provide
Bits
so you can expose one in your API without opening it to alterationMutableBits
Integer.MAX_VALUE
bits, with pluggable backing storage using
sun.misc.Unsafe
concurrent
- Misc concurrency primitives and concurrent statistics collectors, combinable multi-slot locksrange
- A set of interfaces and implementations for dealing conveniently with ranges (things with a numeric start and size) -
a common thing to deal in when writing memory managers, code completion, or dealing with time-series data. If you've ever
coded this stuff, you know it's death-by-off-by-one errors. I never wanted to do so again. Features:
Range
class which implements most featuresint
and long
based specializations of those with type specific performance optimizationsCoalescer
which generates the combined bold+italic.graph
- High-performance, low-memory-footprint graphs (directed and undirected, cyclic and acyclic) based on arrays of BitSets
Comparable
or that a Comparator
can be provided forbits
library, supports graphs larger than Integer.MAX_VALUE
function
- java.util.function
is great until a lambda calls something that throws a checked exception, at which point
things get ugly. This package provides the missing throwing equivalents to what the JDK provides, plus some useful logical
extensions such as ByteSupplier
. Specifically
Exception-
and IOException-
throwing variants of the standard functional interfacesfloat
- and byte-
based equivalents of consumer, function and predicate patternssearch
- generic binary-search that can be applied to any sorted backing-store, such as byte buffers over fixed-length record filessort
- generic sorting of any backing store that contains elements that can be compared, for which a Swapper can be implemented;
sorting pairs of arrays by the contents of one of themutil-collections
- Collection-and collection-related classes for performance and code-bloat reduction, mostly accessed via
static methods on CollectionUtils
. For example:
CollectionUtils.supplierMap(Supplier<T>)
- build caches simply with a supplier that provides missing values, e.g. List<String,List<String>> l = CollectionUtils.supplierMap(ArrayList::new); l.get("foo").add("bar")
setOf(a,b,c)
- quickly create a Set
from some objects (implementation will pick the best Set implementation based on type)Map<String,String> m = map("foo").to("bar").map("baz").finallyTo("quux");
util-fileformat
- Minimal tools for writing valid JSON (for when a library like Jackson is too much), and for
writing .properties
files identically to the way the JDK does, minus the unavoidable timestamp comment that results
in non-repeatable builds when used in annotation processorsutil-time
- takes the pain out of dealing with JDK 8's java.time
package for common tasks
Duration
instancesInterval
, ReadableInterval
and MutableInterval
over java.time
,
which were very useful for time-series data, but, despite java.time
having the same author, absent from the
JDK's time classesTimeUtil
which makes conversion between unix timestamps and Instant
/ ZonedDateTime
/ LocalDateTime
as straightforward as it was in Joda Time (java.time
works in seconds + nanoseconds as its base units, and wants
you to as well - most legacy code uses milliseconds, making it fussy to adapt)util-net
- A few useful networking utilities, including
equals()
- just bland little objects, as they should be, with no magic;PortFinder
- for test framworks, reliably find available network ports to run tests that start
servers concurrently without port-collisions causing unexpected failuresutil-preconditions
- Similar to other preconditions (check that this or that is non-null, non-negative, etc.) except
that by defining its own exceptions, you can differentiate programmer error from caller-error more easily.util-streams
- Stream- and IO-related utilities, including
Tail
, ContinuousLineStream
and ContinuousStringStream
ByteArray*Stream
for NIO, so NIO can fully replace OIO in libraries that are not always working with disk filesMessageDigest
hash as bytes are pulled through themThreadMappedStdIO
- replace System.out
and System.err
on a per-thread basis, for collecting (or discarding) output from
libraries that insist on using these, or capturing the output from external processes without the complexity of pipes -
just provide a PrintStream
to write to and pass a lambda, and all output within its closure will go to the passed streamUnixPath
- platform independently consistent version of java.nio.Path
, useful for writing in-memory filesystemsStreams
- null streams and writers, tee-streams, streams over NIO channels and ByteBuffer
s, and the usual string-reading utilitiesutil-strings
- various string-based utilities, plus support for tab-aligned pretty printing, and eight-bit strings
with deduplication and disposable intern pools, for working with huge amounts of data in limited memoryutil-thread
- Concurrency utilities:
AtomicLinkedQueue
- a thread-safe tail-linked list-like data structure using atomic operationsBufferPool
- keep a thread-safe pool of direct ByteBuffers for reuse and borrow and return themAtomicRoundRobin
- loop through a sequence of numbers atomicallyResettableCountDownLatch
- a reusable CountDownLatch
AtomicMaximum
- atomically track the maximum value of some number, with support for measuring thread contentionThreadLocal
extensions, such as using AutoCloseable
to set and unset, using a Supplier
to provide
a default value, and moreEnhCompletableFuture
- an extension to the JDK's CompletableFuture
which makes combining and chaining
and transformations much similar, taking advantage of the throwing lambdas from function
, and including support for
named futures for logging purposessubscription
- the ultimate variant on the listener pattern - builder-based utilities to construct one-to-many collections of objects interested in
"events" on some object type, with complete flexibility as to how the collections of objects remain referenced, the
way "listeners" are referenced, the dispatch mechanism (immediate, asynchronous, asynchronous-coalesced) for those events,
with no assumptions made about what types of objects those things are - you provide the actual dispatch mechanism, this
library provides the storage and the invocationabstractions
- Core abstractions which pervade Java code and are useful to decompose into their constituent parts - often when
implementing an algorithm such as sorting or binary search, tying that implementation to a particular collection type such as List
limits its usefulness or forces callers to copy their data into a list, when only a subset of the behaviour of a list is required;
using these abstractions instead eliminates those limitations:
Named
- things which have a nameWrapper
- objects which wrap or encapsulate another object and want to expose type-based lookup of the original object or anything it wraps recusivelyStringifier
- types which convert to stringsCopyable
- objects which can have independent copies of themselves madeIntSized
, LongSized
- things which have a sizeIndexed
- things that can be iterated in a defined orderIntAddressable
, LongAddressable
- containers for elements that can be looked up by a numeric indexIndexedResolvable
, LongResolvable
- containers that can be queried for the index of an elementconverters
- Flexibly convert objects of multiple types into each other - you register converters with a Converters
instance,
and it uses the graph
library to find the shortest workable conversion path - so if you registered converter for Path
to CharSequence
and a converter for File
to Path
, and a caller requests that a File
be converted to a CharSequence
, it can resolve the
intermediate steps and perform the operation, using the shortest path within the graph between the two types to minimize
stepsBuilds and a Maven repository containing this project can be found on timboudreau.com.
FAQs
Generic sorting (TIMsort variant) for sorting multiple arrays or collections by one, or any data structure a Swapper can be implemented for (split off from util-collections)
We found that com.mastfrog:sort demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.