341c5de: Faster LinkedHashMap and LinkedHashSet without the key, equivalence or accessOrder option: such a collection keeps its contents in a native Map or Set while it is only added to, read, deleted from and iterated from the front, so those operations cost about what the native ones cost. The first call that needs linked order (putFirst, putLast of a present key, lastEntry, pollLastEntry, addFirst, addLast of a member, getLast, removeLast, any call through reversed(), and map view calls other than size, isEmpty and has) moves the collection to linked records once, in O(n). Results, errors and live iteration are unchanged, including for iterators, cursors and entries open across that call.
The documented bounds change accordingly, a breaking change that ships as a minor release before 1.0: the ends, putFirst, putLast, addFirst, addLast, the view and reversed-view operations, and each eviction of a map with maxSize (and so its inserting methods) are now O(1) amortised, or O(1) amortised average where they were O(1) average. The size budgets of LinkedHashMap (12,736 bytes gzipped) and LinkedHashSet (9,408) and of the whole package (38,144) are raised for the native layout, which adds about 1.5 kB and 0.8 kB gzipped to the two classes.
e987b3c: Faster PriorityQueue, access-ordered LinkedHashMap, ArrayDeque, LinkedList, TreeMap and TreeSet, with the same results, errors, iteration and comparison counts as before.
PriorityQueue without a comparator builds, adds and polls faster while its elements are all numbers or all strings, with the same number of comparisons.LinkedHashMap with accessOrder: true made empty (and without key or equivalence) reads, writes and evicts faster through get, has, set and delete, also with maxSize and onEvict.ArrayDeque.addFirst, pop and poll, and LinkedList.add, addLast, push, addFirst, poll and pop, are faster.TreeMap.get, getOrDefault, has, set, put, putAll and delete, and TreeSet.add, has and delete, are faster while every key is a number, or every key a string, in natural order, with the same number of comparisons.The documented bounds of some LinkedHashMap operations change, which is why this is a minor release: a map with accessOrder: true and neither key nor equivalence, made empty (not from entries or by copy), keeps its mappings in a compact form until the first call on it other than get, has, set, put (unless both maxSize and onEvict are given), delete, size, isEmpty and clear. That call costs O(n), once, so for such a map getOrDefault, put with maxSize and onEvict, remove, replace, getOrInsert, getOrInsertComputed, compute, computeIfPresent, merge, putAll, creating an iterator and the calls through views and reversed() are now documented as amortised. get, has, set and delete keep their bounds.
Bundle size (min + gzip) grows: LinkedHashMap by 1,019 B, PriorityQueue by 408 B, TreeMap by 310 B, TreeSet by 260 B, LinkedHashSet by 163 B, ArrayDeque by 80 B, LinkedList by 36 B, and the whole package by 2,025 B. The size budgets of PriorityQueue and LinkedHashMap are raised to match.
<script> snippet now names the published version with its SHA-384 integrity hash, so it can be copied as it is. Each release also gets a GitHub release with its changelog, the install command and that snippet.HashMap without the key or equivalence option now reads, writes and deletes with one call to its native Map where one suffices and iterates the native Map directly; LinkedHashMap and LinkedHashSet look a key up once; two numbers or two strings are compared without classifying them. Lists and deques build their error messages only when an error is thrown, and default hash collections skip the guard they need only around user callbacks.dist/ are internal and may change in any release.@example to the TSDoc of TreeSetOptions and PriorityQueueOptions. The documentation gains a page of behaviour notes, an API reference site and README badges for the CI result and the line coverage; every code example in README.md and docs/ now runs as a test, and the examples that did not run as written were fixed.First release. Until 1.0.0, a minor version may contain breaking changes; each is listed here
with what to change (see versioning).
ArrayList: a growable list stored in an array, with checked indexes, a stable sort, list
cursors that move both ways, and live subList and reversed views.LinkedList: a double-ended queue stored as a doubly linked list, with node handles for O(1)
insertion and removal next to a known element.ArrayDeque: a double-ended queue stored in a circular array; amortised O(1) at both ends.PriorityQueue: a binary heap that hands out its least element first, by natural order or a
comparator.HashSet and HashMap: behave like native Set and Map (names, insertion order,
SameValueZero, live iteration), with key and equivalence options for value equality, live
key, entry and value views, and compute, merge, getOrInsert and friends.LinkedHashSet and LinkedHashMap: insertion order that can be read and changed at both ends,
live reversed views, and for maps accessOrder and maxSize with onEvict, together an LRU
cache.TreeSet and TreeMap: sorted sets and maps stored as balanced binary search trees, with
O(log n) lookups and nearest-match queries, and live range and reversed views.newSetFromMap: a set over the keys of any library map, with that map's order and eviction.listOf, setOf, mapOf, copyOfList, copyOfSet and copyOfMap: immutable lists, sets
and maps; every change throws UnsupportedOperationError.unmodifiableCollection, unmodifiableList, unmodifiableSet, unmodifiableMap and their
sequenced and sorted forms: read-only windows that show the owner's changes and never nest.asList(array): a list over an array that writes through to it.binarySearch, sortedIndex, reverse, rotate, shuffle, swap, fill,
min, max, frequency, disjoint, indexOfSubList and lastIndexOfSubList.naturalOrder, reverseOrder, comparing, thenComparing, nullsFirst,
nullsLast, and the compareSymbol protocol.equals, hashCode, sameValueZeroEquivalence, valueEquivalence,
and the equalsSymbol and hashCodeSymbol protocols. Hashes are seeded.isCollection, isList, isSetCollection, isMapCollection, isQueue, isDeque,
isSequencedCollection, isSortedSet and isSortedMap, which work across two loaded copies of
the package.IndexOutOfBoundsError, IllegalArgumentError, UnsupportedOperationError,
NullElementError, ClassCastError, NoSuchElementError, IllegalStateError and
ConcurrentModificationError, each extending RangeError, TypeError or Error.<script> build, with types
checked against TypeScript 5.0 and later.