2021-06-22 16:19:19 +02:00
# Primitive-Collections
2021-01-20 04:29:08 +01:00
2021-01-28 21:41:15 +01:00
This is a Simple Primitive Collections Library i started as a hobby Project.
It is based on Java's Collection Library and FastUtil.
But its focus is a different one.
2021-01-20 04:29:08 +01:00
2021-09-20 01:41:24 +02:00
## Main Features:
2021-08-12 15:06:04 +02:00
- ArrayLists / LinkedLists
2021-12-14 09:05:25 +01:00
- HashSets/Maps (Linked & HashControl)
- TreeSets/Maps (RB & AVL)
- EnumMaps
2021-06-27 16:05:43 +02:00
- Immutable Maps/Lists/Sets
2021-12-14 09:05:25 +01:00
- Priority Queues
2021-12-10 03:27:33 +01:00
- Streams & Functional Queries
2021-06-22 16:34:32 +02:00
- SplitIterators
- Iterators
2021-09-19 22:34:46 +02:00
- Pairs
2021-09-28 12:06:51 +02:00
- Unary/Functions
- Suppliers
- Bi/Consumers
2021-04-27 00:49:15 +02:00
2021-12-11 12:53:58 +01:00
## Current Level of Stability
2021-12-11 12:56:01 +01:00
Since this is a relatively new Library, stability was not perfect and some areas are not perfect yet.
2021-12-14 09:05:25 +01:00
Thanks to [ben-manes ](https://github.com/ben-manes ) we now have Roughly 160k unit test covering Maps/Sets/Lists.
2021-12-11 12:56:01 +01:00
These tests cover Javas Collection API completely and ensuring a Stable implementation.
These freshly added tests allowed me to squash thousands of issues according to Googles Test Library (Guava-Tests).
These will be expanded on as time goes on.
2021-12-11 12:53:58 +01:00
2021-09-14 17:19:27 +02:00
## Specialized Functions
New Specialized functions that were added to increase performance or reduce allocations or Quality Of life.
To highlight things that may be wanted.
- Iterable:
2021-10-06 20:33:11 +02:00
- map/flatMap/arrayFlatMap: A Light weight version of Stream.map().
2021-09-20 01:41:24 +02:00
- findFirst: Allows to find the first element of a Predicated Iterable.
- filter: Allows to filter unwanted elements for wrapped Iterable
- matchAny/matchNone/matchAll: Allows to find elements in a collection.
2021-10-06 20:33:11 +02:00
- count: counts all valid elements in a collection.
2021-09-20 01:41:24 +02:00
- forEach: Allows to input a second element into a forEach move allowing for more flexibility for Method References
2021-10-30 07:39:05 +02:00
- reduce/limit/peek/distinct: Light Versions of the Stream variant, to reduce Stream usage.
2021-12-09 09:14:55 +01:00
- pour: a function that allows to collect all elements within the Collection
2021-09-14 17:19:27 +02:00
- Collection:
2021-12-14 09:05:25 +01:00
- addAll: addAll array version
2021-09-14 17:19:27 +02:00
- containsAny: Allows to test if another collection contains an of the elements of the tested collection.
- primitiveStream: Provides access to the closest Java Stream Type.
2021-10-06 20:33:11 +02:00
- copy: shallowCopies the collection, used instead of clone because this is better to use.
2021-12-11 13:27:33 +01:00
(subCollections not supported for obvious reasons)
2021-12-09 09:14:55 +01:00
- toArray: the ToArray function from Java9 and newer that uses a Functional interface and can use a method reference
2021-09-14 17:19:27 +02:00
- List:
- add/get/removeElements (From FastUtil): Allows to add/get/remove an Array into/from a list. Just with less overhead
- extractElements: Allows to remove a Range of elements from the List and get what was removed.
- Unstable Sort(From FastUtil): Uses a faster but not stable sort (Quick-Sort as example) to sort the list.
2021-10-30 07:39:05 +02:00
- addIfAbsent/Present: adds a element only if absent/present in the list
- swapRemove: deletes a desired element and inserts the last element in its place instead of leftshifting elements.
2021-09-14 17:19:27 +02:00
- SortedSet:
- addAndMoveToFirst/Last (From FastUtil but moved to Interface): Allows to add a element to the first/last position of a sorted set.
- moveToFirst/Last: Moves the desired element at the first/last position of the SortedSet.
- pollFirst/Last: Allows to poll the first/last element of the set.
- Map:
- putAll: putAll but in Array form.
- putAllIfAbsent: Puts only the elements that are absent.
- addTo (Only Primitives Values) (From FastUtil but moved to Interface): allows to add to the value of a given key. If not present it will be added. (Accumulator)
- addToAll: Same as addTo but bulkVersion.
- removeOrDefault: removes a Element and if not present returns the default value instead of the present value.
- mergeAll: BulkVersion of Merge function.
2021-09-28 13:20:05 +02:00
- supplyIfAbsent: A Supplier based computeIfAbsent
2021-09-14 17:19:27 +02:00
- Sorted Map:
- addAndMoveToFirst/Last (From FastUtil but moved to Interface): Allows to add a element to the first/last position of a sorted Map.
- moveToFirst/Last: Moves the desired element at the first/last position of the Map.
- getAndMoveToFirst/Last: gets the element and moves it to the first/last position. Replicating a Optional LinkedHashMap feature.
- pollFirst/LastKey: Allows to poll the first/last element.
- first/LastValue: Allows to get the first/last value from the Map.
2021-06-23 19:22:19 +02:00
# Notes about Versions
2021-06-23 19:34:32 +02:00
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.
Any breaking changes will be Documented (once 1.0 is released)
2021-06-23 19:22:19 +02:00
2021-10-11 19:39:09 +02:00
Also to save space every 0.0.x (Patch) that is 2 Minor Versions behind will be removed.
So if 0.5.0 is released every 0.3.x patch will be deleted, except for the last patch for that minor version.
2021-06-22 15:53:52 +02:00
# How to install
Using Gradle:
```gradle
repositories {
maven {
url = "https://maven.speiger.com/repository/main"
}
}
dependencies {
2021-12-14 09:05:25 +01:00
compile 'de.speiger:Primitive-Collections:0.5.1'
2021-06-22 15:53:52 +02:00
}
2021-08-12 15:03:52 +02:00
```
2021-08-12 15:03:05 +02:00
Direct:
| Version | Jar | Sources | Java Doc |
|--------- |------------------------------------------------------------------------------------------------------------------------------ |-------------------------------------------------------------------------------------------------------------------------------------- |-------------------------------------------------------------------------------------------------------------------------------------- |
2021-12-14 09:05:25 +01:00
| 0.5.1 | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.1/Primitive-Collections-0.5.1.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.1/Primitive-Collections-0.5.1-sources.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.1/Primitive-Collections-0.5.1-javadoc.jar ) |
2021-12-11 13:27:33 +01:00
| 0.5.0 | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.0/Primitive-Collections-0.5.0.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.0/Primitive-Collections-0.5.0-sources.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.0/Primitive-Collections-0.5.0-javadoc.jar ) |
2021-10-30 07:39:05 +02:00
| 0.4.5 | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.5/Primitive-Collections-0.4.5.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.5/Primitive-Collections-0.4.5-sources.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.5/Primitive-Collections-0.4.5-javadoc.jar ) |
2021-10-11 19:05:54 +02:00
| 0.4.4 | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.4/Primitive-Collections-0.4.4.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.4/Primitive-Collections-0.4.4-sources.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.4/Primitive-Collections-0.4.4-javadoc.jar ) |
2021-10-07 14:50:52 +02:00
| 0.4.3 | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.3/Primitive-Collections-0.4.3.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.3/Primitive-Collections-0.4.3-sources.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.3/Primitive-Collections-0.4.3-javadoc.jar ) |
2021-10-06 20:53:19 +02:00
| 0.4.2 | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.2/Primitive-Collections-0.4.2.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.2/Primitive-Collections-0.4.2-sources.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.2/Primitive-Collections-0.4.2-javadoc.jar ) |
2021-09-29 02:11:29 +02:00
| 0.4.1 | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.1/Primitive-Collections-0.4.1.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.1/Primitive-Collections-0.4.1-sources.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.1/Primitive-Collections-0.4.1-javadoc.jar ) |
2021-09-20 01:41:24 +02:00
| 0.4.0 | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.0/Primitive-Collections-0.4.0.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.0/Primitive-Collections-0.4.0-sources.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.4.0/Primitive-Collections-0.4.0-javadoc.jar ) |
2021-09-13 17:09:31 +02:00
| 0.3.6 | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.3.6/Primitive-Collections-0.3.6.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.3.6/Primitive-Collections-0.3.6-sources.jar ) | [Download ](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.3.6/Primitive-Collections-0.3.6-javadoc.jar ) |
2021-06-22 15:53:52 +02:00
2021-06-22 16:34: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?
2021-09-20 01:41:24 +02:00
- 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 )
2021-06-22 16:34:32 +02:00
2021-09-20 01:41:24 +02:00
Please if you want to contribute follow the [Rule-Sheet ](RuleSheet.md ). It keeps everything in line.
2021-06-22 16:34:32 +02:00
2021-06-22 15:53:52 +02:00
# How to Build
2021-01-20 04:29:08 +01:00
2021-06-22 16:34:32 +02:00
The SourceCode can be generated via:
2021-01-29 11:41:48 +01:00
/gradlew.bat generateSource
2021-06-22 16:34:32 +02:00
to build the jar:
/gradlew.bat build
do not combine the commands because they can not be executed at the same time.
2021-01-28 21:39:58 +01:00
2021-04-27 00:49:15 +02:00
## Current Down Sides (Random order)
2021-09-13 17:09:31 +02:00
- Documentation is only present at the lowest level for most cases and needs a typo fixing.