Primitive-Collections/README.md

94 lines
3.9 KiB
Markdown
Raw Permalink Normal View History

2022-06-14 10:44:02 +02:00
![build](https://github.com/Speiger/Primitive-Collections/actions/workflows/build_action.yml/badge.svg)
[![Latest Release](https://jitpack.io/v/Speiger/Primitive-Collections.svg)](https://jitpack.io/#Speiger/Primitive-Collections)
2024-03-30 01:08:38 +01:00
![Maven Central Version](https://img.shields.io/maven-central/v/io.github.speiger/Primitive-Collections)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
2022-06-14 10:44:02 +02:00
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/Speiger/Primitive-Collections)
![Unit Tests](https://github.com/Speiger/Primitive-Collections/actions/workflows/build_tests_action.yml/badge.svg)
![Coverage](https://gist.githubusercontent.com/Speiger/280257cd19cbe1dda3789bebd4ff65cf/raw/405abd1d2f6c19ac70f20b8b1772176f42d5c5d3/jacoco.svg)
Version 0.7.0 Release - Added: Coverage Badge - Updated: Changelog. - Changed: Changelog now has info how to obtain the sourcecode. - Added: Over 11 Million Unit Tests to this library to ensure quality. - Added: ArrayList size constructor now throws IllegalStateException if the size parameter is negative - Added: EnumMap specialized forEach implementation. - Added: AbstractMap.remove now delegates to its primitive counterpart. - Added: ConcurrentHashMap now implements ITrimmable - Refactor: Removed a lot of disabled code from ArraySet. - Removed: LinkedList.addAll(index, List) now delegates to LinkedList.addAll(index, Collection) due to no special optimization required. - Fixed: AbstractList.SubList.get/set/swapRemove didn't calculate their List index Properly - Fixed: AbstractList.SubList chains now properly if you create SubLists within SubLists. - Fixed: AbstractList.Iterator.add now respects Immutable/UnmodifiableLists. - Fixed: AbstractList.Iterator.skip/back now keep track of the last returned value for remove function to work properly. - Fixed: CopyOnWriteArrayList.extract/removeElements(int, int) does now proper range checks and remove elements properly. - Fixed: CopyOnWriteArrayList.SubList now works properly. (Reimplemented entirely) - Fixed: CopyOnWriteArrayList.Iterator.previous() was returning the wrong values. - Fixed: CopyOnWriteArrayList.Iterator.skip now skips the right amount of elements and stops where it should. - Fixed: LinkedList.first/last/dequeue/dequeueLast now throws NoSuchElementException when empty instead of IllegalStateException. - Fixed: LinkedList had an edge case where the entire reverse iterator would break if the wrong element was removed. - Fixed: LinkedList.extractElement now returns the correct values. - Fixed: AbstractMap.entrySet().remove(Object) now returns true if defaultReturnValue elements were removed. - Fixed: ConcurrentHashMap.remove(Object, Object) checks if the type matches before comparing against null Values. - Fixed: LinkedHashMap.clearAndTrim() was checking the wrong value for determining the full reset or clearing of a Map. - Fixed: HashMap.trim/clearToTrim() was using the wrong value to determin if something should be done. - Fixed: HashMap now compares empty values (0) against nullKeys when Object Variants of the type are used. - Fixed: ImmutableMap now compares empty values (0) against nullKeys when Object Variants of the type are used. - Fixed: ArrayMap.iterator(key) now throws NoSuchElementException when the element wasn't found. - Fixed: Linked/EnumMap array constructor was creating the wrong size values array. - Fixed: LinkedEnumMap.getAndMoveToFirst/Last was moving elements even if the element wasn't present. - Fixed: AVL/RBTreeMap.getFirst/LastKey was not throwing a NoSuchElementException if the map was empty. - Fixed: Map.Builder wasn't throwing a IllegalStateException when creating a negative size builder. - Fixed: AVL/RBTreeSet.DecendingSet.subSet(from, fromInclusive, to, toInclusive) was creating a corrupt asending subset. - Fixed: ArraySet throws now a IllegalStateException when trying to create it with a negative size. - Fixed: ArraySet.addMoveToLast(key) was crashing when a key was already present. - Fixed: Immutable/LinkedHashSet now keep track of their iteration index properly. - Fixed: LinkedHashSet.moveToFirst/Last(key) would crash if the Set was empty. - Fixed: LinkedHashSet.clearAndTrim() was checking the wrong value for determining the full reset or clearing of a Map. - Fixed: HashSet.trim/clearToTrim() was using the wrong value to determin if something should be done.
2022-06-12 14:31:45 +02:00
[![codecov](https://codecov.io/gh/Speiger/Primitive-Collections/branch/debug/graph/badge.svg?token=WSTSNJM0EN)](https://codecov.io/gh/Speiger/Primitive-Collections)
2022-06-14 10:44:02 +02:00
![Tests Done](https://gist.githubusercontent.com/Speiger/280257cd19cbe1dda3789bebd4ff65cf/raw/405abd1d2f6c19ac70f20b8b1772176f42d5c5d3/tests.svg)
# Primitive-Collections
2022-04-18 09:06:32 +02:00
This is a Simple Primitive Collections Library aimed to outperform Java's Collection Library and FastUtil.
Both in Performance and Quality of Life Features.
## Benchmarks
2022-04-18 21:41:55 +02:00
Benchmarks can be found here: [[Charts]](https://github.com/Speiger/Primitive-Collections-Benchmarks/blob/master/BENCHMARKS-CHARTS.md), [[Tables]](https://github.com/Speiger/Primitive-Collections-Benchmarks/blob/master/BENCHMARKS.md)
2022-04-18 09:06:32 +02:00
## Special Features
[Here](features.md) you find a set of features added to Primitive Collections.
These are designed to improve performance or to provide Quality of Life.
2022-12-19 16:03:43 +01:00
[Here](EXTRAS.md) you also find features that can be used when you compile the library for yourself.
These features are not used by default to have a wider range of compat, or require self compilation.
Such as pruning classes that are not needed in your code.
## Main Features:
- ArrayLists / LinkedLists / CopyOnWriteLists
- HashSets/Maps (Linked & HashControl)
- TreeSets/Maps (RB & AVL)
- EnumMaps
2021-06-27 16:05:43 +02:00
- Immutable Maps/Lists/Sets
- ConcurrentHashMaps
- Priority Queues
2021-12-10 03:27:33 +01:00
- Streams & Functional Queries
2022-04-18 09:06:32 +02:00
- Split/Iterators
2021-09-19 22:34:46 +02:00
- Pairs
- Unary/Functions
- Suppliers
- Bi/Consumers
2022-04-18 09:06:32 +02:00
- AsyncBuilders
2022-04-17 20:21:48 +02:00
# Notes about Versions
Any 0.x.0 version (Minor) can be reason for massive changes including API.
To ensure that problems can be dealt with even if it is breaking the current API.
2021-06-22 15:53:52 +02:00
# How to install
2022-04-21 17:41:50 +02:00
Using Jitpack Gradle
```groovy
2021-06-22 15:53:52 +02:00
repositories {
maven {
2022-04-21 17:41:50 +02:00
url = "https://jitpack.io"
2021-06-22 15:53:52 +02:00
}
}
dependencies {
2023-06-29 22:52:44 +02:00
implementation 'com.github.Speiger:Primitive-Collections:0.9.0'
2022-04-14 09:51:36 +02:00
}
```
2021-06-22 15:53:52 +02:00
Using Maven Central
```groovy
dependencies {
implementation 'io.github.speiger:Primitive-Collections:0.9.0'
}
```
Version 0.7.0 Release - Added: Coverage Badge - Updated: Changelog. - Changed: Changelog now has info how to obtain the sourcecode. - Added: Over 11 Million Unit Tests to this library to ensure quality. - Added: ArrayList size constructor now throws IllegalStateException if the size parameter is negative - Added: EnumMap specialized forEach implementation. - Added: AbstractMap.remove now delegates to its primitive counterpart. - Added: ConcurrentHashMap now implements ITrimmable - Refactor: Removed a lot of disabled code from ArraySet. - Removed: LinkedList.addAll(index, List) now delegates to LinkedList.addAll(index, Collection) due to no special optimization required. - Fixed: AbstractList.SubList.get/set/swapRemove didn't calculate their List index Properly - Fixed: AbstractList.SubList chains now properly if you create SubLists within SubLists. - Fixed: AbstractList.Iterator.add now respects Immutable/UnmodifiableLists. - Fixed: AbstractList.Iterator.skip/back now keep track of the last returned value for remove function to work properly. - Fixed: CopyOnWriteArrayList.extract/removeElements(int, int) does now proper range checks and remove elements properly. - Fixed: CopyOnWriteArrayList.SubList now works properly. (Reimplemented entirely) - Fixed: CopyOnWriteArrayList.Iterator.previous() was returning the wrong values. - Fixed: CopyOnWriteArrayList.Iterator.skip now skips the right amount of elements and stops where it should. - Fixed: LinkedList.first/last/dequeue/dequeueLast now throws NoSuchElementException when empty instead of IllegalStateException. - Fixed: LinkedList had an edge case where the entire reverse iterator would break if the wrong element was removed. - Fixed: LinkedList.extractElement now returns the correct values. - Fixed: AbstractMap.entrySet().remove(Object) now returns true if defaultReturnValue elements were removed. - Fixed: ConcurrentHashMap.remove(Object, Object) checks if the type matches before comparing against null Values. - Fixed: LinkedHashMap.clearAndTrim() was checking the wrong value for determining the full reset or clearing of a Map. - Fixed: HashMap.trim/clearToTrim() was using the wrong value to determin if something should be done. - Fixed: HashMap now compares empty values (0) against nullKeys when Object Variants of the type are used. - Fixed: ImmutableMap now compares empty values (0) against nullKeys when Object Variants of the type are used. - Fixed: ArrayMap.iterator(key) now throws NoSuchElementException when the element wasn't found. - Fixed: Linked/EnumMap array constructor was creating the wrong size values array. - Fixed: LinkedEnumMap.getAndMoveToFirst/Last was moving elements even if the element wasn't present. - Fixed: AVL/RBTreeMap.getFirst/LastKey was not throwing a NoSuchElementException if the map was empty. - Fixed: Map.Builder wasn't throwing a IllegalStateException when creating a negative size builder. - Fixed: AVL/RBTreeSet.DecendingSet.subSet(from, fromInclusive, to, toInclusive) was creating a corrupt asending subset. - Fixed: ArraySet throws now a IllegalStateException when trying to create it with a negative size. - Fixed: ArraySet.addMoveToLast(key) was crashing when a key was already present. - Fixed: Immutable/LinkedHashSet now keep track of their iteration index properly. - Fixed: LinkedHashSet.moveToFirst/Last(key) would crash if the Set was empty. - Fixed: LinkedHashSet.clearAndTrim() was checking the wrong value for determining the full reset or clearing of a Map. - Fixed: HashSet.trim/clearToTrim() was using the wrong value to determin if something should be done.
2022-06-12 14:31:45 +02:00
# SourceCode
The generated Sourcecode can be automatically build,
but if you want to just browse around in it.
Check out the [Debug Branch](https://github.com/Speiger/Primitive-Collections/tree/debug/src/main/java/speiger/src/collections), which has the entire up to date code.
2022-04-18 09:06:32 +02:00
# Contributing
If you want to contribute.
This project is created using gradle and java and my Template Library only. Nothing extra.
If you setup gradle the library will be downloaded automatically.
Where is everything stored?
- Variables and ClassNames are define [here](src/builder/java/speiger/src/builder/GlobalVariables.java)
- Templates are stored [here](src/builder/resources/speiger/assets/collections/templates)
- Tests can be found [here](src/test/java/speiger/src/collections)
Please if you want to contribute follow the [Rule-Sheet](RuleSheet.md). It keeps everything in line.
2021-06-22 15:53:52 +02:00
# How to Build
The SourceCode can be generated via:
2022-12-19 16:03:43 +01:00
```
/gradlew.bat generateSource
2022-12-19 16:03:43 +01:00
```
to generate SourceCode and build the jar:
2022-12-19 16:03:43 +01:00
```
/gradlew.bat build
```