Skip navigation links

Package org.plumelib.util

Plume-lib Util: Utility libraries for Java

See: Description

Package org.plumelib.util Description

Plume-lib Util: Utility libraries for Java

Collections and iterators

ArraysPlume
Utilities for manipulating arrays and collections. This complements java.util.Arrays and java.util.Collections.
CollectionsPlume
Utilities for manipulating collections, iterators, lists, maps, and sets.
CombinationIterator
Given a set of collections, return all combinations that take one element from each collection.
LimitedSizeSet
Stores up to some maximum number of unique values, at which point its rep is nulled, in order to save space.
LimitedSizeIntSet
Stores up to some maximum number of unique integer values, at which point its rep is nulled, in order to save space. More efficient than LimitedSizeSet<Integer>.
OrderedPairIterator
Given two sequences/iterators/whatever, OrderedPairIterator returns a new sequence/iterator/whatever that pairs the matching elements of the inputs, according to their respective sort orders. (This operation is sometimes called "zipping".)
WeakHasherMap
WeakHashMap is a modified version of WeakHashMap from JDK 1.2.2, that adds a constructor that takes a Hasher argument.
WeakIdentityHashMap
WeakIdentityHashMap is a modified version of WeakHashMap from JDK 1.5, that uses System.identityHashCode() rather than the object's hash code.

Text processing

EntryReader
Class that reads "entries" from a file. In the simplest case, entries can be lines. It supports: include files, comments, and multi-line entries (paragraphs). The syntax of each of these is customizable.
RegexUtil
Utility methods for regular expressions, most notably for testing whether a string is a regular expression.
FileIOException
Extends IOException by also reporting a file name and line number at which the exception occurred.
FileWriterWithName
Just like FileWriter, but adds a getFileName() method and overrides toString() to give the file name.

Math

MathPlume
Mathematical utilities.
FuzzyFloat
Routines for doing approximate ('fuzzy') floating point comparisons. Those are comparisons that only require the floating point numbers to be relatively close to one another to be equal, rather than exactly equal.

Random selection

RandomSelector
Selects k elements uniformly at random from an arbitrary iterator, using O(k) space.
MultiRandSelector
Like RandomSelector, performs a uniform random selection over an iterator. However, the objects in the iteration may be partitioned so that the random selection chooses the same number from each group.

Determinism and immutability

DeterministicObject
A version of Object with a deterministic hashCode() method. Instantiate this instead of Object to remove a source of nondeterminism from your programs.
ClassDeterministic
Deterministic versions of java.lang.Class methods, which return arrays in sorted order.
UniqueId
An interface for objects that have a unique ID. If you are tempted to print the value of System.identityHashCode(), consider using this instead.
ImmutableTypes
Indicates which types in the JDK are immutable.

Utility interfaces

Filter
Interface for things that make boolean decisions. This is inspired by java.io.FilenameFilter.
Partitioner
A Partitioner accepts Objects and assigns them to an equivalence class.

Miscellaneous

DumpHeap
Dumps the heap into a .hprof file.
GraphPlume
Graph utility methods. This class does not model a graph: all methods are static.
Intern
Utilities for interning objects. Interning is also known as canonicalization or hash-consing: it returns a single representative object that .equals() the object, and the client discards the argument and uses the result instead.
UtilPlume
Utility functions that do not belong elsewhere in the plume package.
Pair
Mutable pair class: type-safely holds two objects of possibly-different types.
WeakIdentityPair
Immutable pair class: type-safely holds two objects of possibly-different types. Differs from Pair in the following ways: is immutable, cannot hold null, holds its elements with weak pointers, and its equals() method uses object equality to compare its elements.
Skip navigation links