Class AVector<T extends ACell>

java.lang.Object
Type Parameters:
T - Type of element in Vector
All Implemented Interfaces:
IAssociative<CVMLong,T>, IValidated, IWriteable, Iterable<T>, Collection<T>, List<T>, SequencedCollection<T>
Direct Known Subclasses:
ASpecialVector, VectorLeaf, VectorTree

public abstract class AVector<T extends ACell> extends ASequence<T>
Abstract base class for vectors. Vectors are immutable sequences of values, with efficient appends to the tail of the list. This is a hierarchy with multiple implementations for different vector types, but all should conform to the general AVector interface. We use an abstract base class in preference to an interface because we control the hierarchy and it offers some mild performance advantages. General design goals: - Immutability - Cell structure breakdown for larger vectors, while keeping a shallow tree - Optimised performance for end of vector (conj, pop, last etc.) - Fast prefix comparisons to support consensus algorithm "If I had any recommendation to you at all, it's just if you're thinking about designing a system and you're not sure, whether you can answer all that questions in the forward direction, choose immutability. You can almost back into a little more than 50% of this design just by haven taken immutability as a constraint, saying 'oh my god now what am I gonna do? I cannot change this. I better do this!' And keep forcing you into good answers. So if I had any architectural guidance from this: Just do it. Choose immutability and see where it takes you." - Rich Hickey