Simple library to create primitive collections. Using template files to generate them. Project for self teaching.
Go to file
Speiger 26b9d6706d Fixed Classification 2022-04-14 09:34:16 +02:00
.github/workflows And hopefully the last javaDoc fixes 2022-04-08 00:24:37 +02:00
gradle/wrapper Moving to a more up to date system. 2022-04-07 16:00:58 +02:00
src Finishing touches for the 0.6.0 release. 2022-04-14 07:29:32 +02:00
.classpath Changes. 2021-09-28 04:43:04 +02:00
.gitattributes Removed the double foldering and started some seriouse work. 2020-11-11 21:33:59 +01:00
.gitignore Moving Credentials Away from this file because now i need it 2021-12-27 19:59:19 +01:00
.project Map Tests & BugFixes. 2021-04-22 23:02:04 +02:00
Changelog.md Finishing touches for the 0.6.0 release. 2022-04-14 07:29:32 +02:00
LICENSE Update LICENSE 2021-12-19 21:19:28 +01:00
README.md Finishing touches for the 0.6.0 release. 2022-04-14 07:29:32 +02:00
RuleSheet.md New Content patch getting big progress on base and progress on lists. 2020-11-16 02:55:33 +01:00
build.gradle Fixed Classification 2022-04-14 09:34:16 +02:00
gradle.properties Added gradle now uses the java version it runs on. 2022-04-07 20:26:53 +02:00
gradlew Removed the double foldering and started some seriouse work. 2020-11-11 21:33:59 +01:00
gradlew.bat Removed the double foldering and started some seriouse work. 2020-11-11 21:33:59 +01:00
jitpack.yml Fixing Jitpack Publishing 2022-04-14 09:24:13 +02:00
settings.gradle Removed the double foldering and started some seriouse work. 2020-11-11 21:33:59 +01:00

README.md

build

Primitive-Collections

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.

Main Features:

  • ArrayLists / LinkedLists / CopyOnWriteLists
  • HashSets/Maps (Linked & HashControl)
  • TreeSets/Maps (RB & AVL)
  • EnumMaps
  • Immutable Maps/Lists/Sets
  • ConcurrentHashMaps
  • Priority Queues
  • Streams & Functional Queries
  • SplitIterators
  • Iterators
  • Pairs
  • Unary/Functions
  • Suppliers
  • Bi/Consumers
  • AsyncBuilders

Current Level of Stability

Since this is a relatively new Library, stability was not perfect and some areas are not perfect yet.
Thanks to ben-manes we now have Roughly 160k unit test covering Maps/Sets/Lists.
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.

Benchmarks

Benchmarks can be found here: Click Me

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:
    • map/flatMap/arrayFlatMap: A Light weight version of Stream.map().
    • 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.
    • count: counts all valid elements in a collection.
    • forEach: Allows to input a second element into a forEach move allowing for more flexibility for Method References
    • reduce/limit/peek/distinct: Light Versions of the Stream variant, to reduce Stream usage.
    • pour: a function that allows to collect all elements within the Collection
  • Collection:
    • addAll: addAll array version
    • 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.
    • copy: shallowCopies the collection, used instead of clone because this is better to use. (subCollections not supported for obvious reasons)
    • toArray: the ToArray function from Java9 and newer that uses a Functional interface and can use a method reference
  • 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.
    • 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.
  • 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)
    • subFrom (Only Primitive Values): allows to subtract from the value of a given key. If value reached getDefaultReturnValue() element will be removed.
    • 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.
    • supplyIfAbsent: A Supplier based computeIfAbsent
  • 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.

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.
Any breaking changes will be Documented (once 1.0 is released)

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.

How to install

Using Gradle:

repositories {
    maven {
        url = "https://maven.speiger.com/repository/main"
    }
}
dependencies {
	compile 'de.speiger:Primitive-Collections:0.6.0'
}

Direct:

Version Jar Sources Java Doc
0.6.0 Download Download Download
0.5.3 Download Download Download
0.5.2 Download Download Download
0.5.1 Download Download Download
0.5.0 Download Download Download
0.4.5 Download Download Download
0.4.4 Download Download Download
0.4.3 Download Download Download
0.4.2 Download Download Download
0.4.1 Download Download Download
0.4.0 Download Download Download
0.3.6 Download Download Download

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
  • Templates are stored here
  • Tests can be found here

Please if you want to contribute follow the Rule-Sheet. It keeps everything in line.

How to Build

The SourceCode can be generated via:
/gradlew.bat generateSource

to build the jar:
/gradlew.bat build
do not combine the commands because they can not be executed at the same time.

Current Down Sides (Random order)

  • Documentation is only present at the lowest level for most cases and needs a typo fixing.