Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2417 Explore reimplementing HashMap as CHAMP (Compressed Hash-Array Mapped Prefix-tree) #2745

Open
wants to merge 181 commits into
base: version/1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
95ea776
Adds class ChampSet and supporting classes.
wrandelshofer Jun 18, 2022
b651aa5
Adds LinkedChampSet and supporting classes.
wrandelshofer Jun 18, 2022
3509123
Refactors SetMixin.
wrandelshofer Jun 19, 2022
42a096b
Fixes inspection warnings.
wrandelshofer Jun 19, 2022
5f6cd8c
Adds ChampMap and supporting classes.
wrandelshofer Jun 19, 2022
52a232f
Adds SELF type to SetMixin.
wrandelshofer Jun 19, 2022
0d164b3
Removes debugging code in constructor.
wrandelshofer Jun 19, 2022
1940f13
Adds JMH benchmarks.
wrandelshofer Jun 19, 2022
7a01568
Adds LinkedChampMap and supporting classes.
wrandelshofer Jun 19, 2022
8b132ba
Adds benchmarks.
wrandelshofer Jun 19, 2022
5330aaf
Adds benchmarks.
wrandelshofer Jun 19, 2022
4dcd7d1
Updates readme file.
wrandelshofer Jun 19, 2022
c7d6f5b
Updates readme file.
wrandelshofer Jun 19, 2022
3a3c9df
Updates readme file.
wrandelshofer Jun 19, 2022
227f2ba
Updates readme file.
wrandelshofer Jun 19, 2022
605cc89
Updates readme file.
wrandelshofer Jun 19, 2022
0402595
Updates chart and JMH tests.
wrandelshofer Jun 19, 2022
8eb395c
Updates readme.
wrandelshofer Jun 19, 2022
809d4a3
Modularity: Moves all CHAMP classes into a separate package. Cracks v…
wrandelshofer Jun 23, 2022
097ebe5
Removes method Node.updateAll().
wrandelshofer Aug 5, 2022
270a0da
Simplifies renumber()-methods.
wrandelshofer Aug 5, 2022
0de6e71
Renames class ChampTrie to NodeFactory.
wrandelshofer Aug 5, 2022
2f587de
Fixes clear()-method.
wrandelshofer Aug 5, 2022
85c6ab2
Adds javadoc comments.
wrandelshofer Aug 5, 2022
3d5633e
Reduces size of code.
wrandelshofer Aug 5, 2022
da380ea
Renames interface Sequenced to SequencedKey.
wrandelshofer Aug 6, 2022
b90c96e
Refactors class ChangeEvent.
wrandelshofer Aug 6, 2022
dcd0db4
Partially refactors 'key' to 'data' in class Node and its sub-classes.
wrandelshofer Aug 6, 2022
9fcdd9a
Improves javadoc. Refactors more code to improve its clarity.
wrandelshofer Aug 7, 2022
82392e0
Adds performance tests for Kotlinx collections.
wrandelshofer Aug 7, 2022
a0919e8
Merge pull request #1 from vavr-io/master
wrandelshofer Jan 24, 2023
598ebcc
Add ChampChampSet and associated classes.
wrandelshofer Apr 1, 2023
bf9f662
Add ChampChampMap and associated classes. (WIP)
wrandelshofer Apr 2, 2023
71cf364
Clean code of Champ collections up.
wrandelshofer Apr 2, 2023
6569c67
Clean code up. Add benchmark results. Update readme.
wrandelshofer Apr 2, 2023
3b0961e
Add benchmark results.
wrandelshofer Apr 3, 2023
2c95045
Add benchmark results of VavrChampSetJmh.
wrandelshofer Apr 3, 2023
8b7d7b2
Add benchmark results. Add more information to readme.
wrandelshofer Apr 4, 2023
cb5fdb8
Add benchmark results. Add more information to readme.
wrandelshofer Apr 4, 2023
3e8dcfd
Improve readme.
wrandelshofer Apr 4, 2023
e07b9e2
Add more JMH benchmarks.
wrandelshofer Apr 21, 2023
fee08d0
Merge remote-tracking branch 'vavr/master'
wrandelshofer Apr 21, 2023
24c6d5e
Revert changes in readme file.
wrandelshofer Apr 22, 2023
bc03e53
Rename champ collection classes to HashMap, LinkedHashMap and so on.
wrandelshofer Apr 22, 2023
6dcf746
Make all tests work.
wrandelshofer Apr 23, 2023
4b19526
Revert changes in README.md.
wrandelshofer Apr 23, 2023
8431a50
Revert changes in README.md (but this time without reformatting).
wrandelshofer Apr 23, 2023
c328246
Remove JMH benchmarks.
wrandelshofer Apr 23, 2023
5f9df6c
Make mutable collections package private.
wrandelshofer Apr 23, 2023
1c090e2
Revert changes in TreeMapTest.java and CodingConventions.java.
wrandelshofer Apr 23, 2023
2d7379c
Revert changes in AbstractMapTest.java, HashMapTest.java, LinkedHashM…
wrandelshofer Apr 23, 2023
7edee7e
WIP: Replace internal representation of HashSet by a CHAMP trie.
wrandelshofer Apr 29, 2023
3517e11
WIP: Replace internal representation of HashSet by a CHAMP trie.
wrandelshofer Apr 29, 2023
1889bfb
WIP: Add licensing info. Change file headers.
wrandelshofer Apr 30, 2023
a549389
WIP: Replace internal representation of HashMap by a CHAMP trie.
wrandelshofer Apr 30, 2023
6c1b308
WIP: Replace internal representation of LinkedHashSet by a CHAMP trie.
wrandelshofer May 1, 2023
9ea6ea0
WIP: Replace internal representation of LinkedHashMap by a CHAMP trie.
wrandelshofer May 1, 2023
3bf4c06
WIP: Improve performance with transience.
wrandelshofer May 1, 2023
a091c97
Rename 'reversed' by 'reverse' where appropriate.
wrandelshofer May 1, 2023
3bba2c5
Add benchmarks.
wrandelshofer May 2, 2023
52eb375
Add benchmarks.
wrandelshofer May 2, 2023
6bb9ee4
Add more benchmarks.
wrandelshofer May 3, 2023
58ffd28
WIP Add bulk operations.
wrandelshofer May 7, 2023
9d61c8c
Fix iteration order for HashSet.
wrandelshofer May 7, 2023
81f05bb
Implement bulk operations for HashMap and HashSet.
wrandelshofer May 7, 2023
32a3db1
Remove unintentional 'public' and 'protected' modifiers. Add benchmar…
wrandelshofer May 7, 2023
45f16fe
Fix method putAllEntries().
wrandelshofer May 7, 2023
e81af7f
Implement bulk operations for LinkedHashSet.
wrandelshofer May 8, 2023
db341e5
Merge remote-tracking branch 'origin/champ-dev'
wrandelshofer May 8, 2023
296b659
Revert unwanted changes in this branch.
wrandelshofer May 8, 2023
f8f9e38
Implement bulk operations in LinkedHashMap.
wrandelshofer May 10, 2023
f8cae40
Merge remote-tracking branch 'origin/champ-dev'
wrandelshofer May 10, 2023
9d7fbf7
Replace instanceof-pattern with cast.
wrandelshofer May 10, 2023
89bd244
Replace record with class.
wrandelshofer May 10, 2023
c6d913f
Port code back to Java 8.
wrandelshofer May 10, 2023
d54b89a
Merge remote-tracking branch 'origin/champ-dev'
wrandelshofer May 10, 2023
c0e0066
Remove JMH benchmarks.
wrandelshofer May 10, 2023
5317e10
Revert changes in build.gradle.
wrandelshofer May 10, 2023
843dd55
Lump third-party licenses into a single file.
wrandelshofer May 10, 2023
23f8b64
Merge branch 'champ-dev'
wrandelshofer May 10, 2023
86eb888
Remove HAMT.
wrandelshofer May 10, 2023
77a4df8
Revert HashSetTest and HashMapTest.
wrandelshofer May 10, 2023
f07ef4a
Force HashSet to comply with HashSetTest.
wrandelshofer May 10, 2023
50d0b3f
Merge remote-tracking branch 'origin/champ-dev'
wrandelshofer May 10, 2023
def1e0c
Revert changes in build.gradle.
wrandelshofer May 10, 2023
7e2538c
Revert changes in files.
wrandelshofer May 10, 2023
06bc0fa
Revert changes in file.
wrandelshofer May 10, 2023
9b1ca5c
Merge branch 'champ-dev'
wrandelshofer May 10, 2023
b62562a
Revert formatting changes in file.
wrandelshofer May 10, 2023
b058637
Merge remote-tracking branch 'origin/champ-dev'
wrandelshofer May 10, 2023
0ca19b7
Lump classes together.
wrandelshofer May 10, 2023
ff175f3
Merge branch 'champ-dev'
wrandelshofer May 10, 2023
e12320c
Toggle case of licenses. The disclaimer has to be 'conspicuous' - and…
wrandelshofer May 12, 2023
9b4a181
Clarifying use of references in this code.
wrandelshofer May 12, 2023
c37f86c
Simplify code in ChampIteration.
wrandelshofer May 12, 2023
a1e8fbf
Remove obsolete javadoc.
wrandelshofer May 12, 2023
e4b35b3
Simplify code.
wrandelshofer May 12, 2023
4948892
Adds class ChampSet and supporting classes.
wrandelshofer Jun 18, 2022
0bb7aca
Adds LinkedChampSet and supporting classes.
wrandelshofer Jun 18, 2022
e90a1b0
Refactors SetMixin.
wrandelshofer Jun 19, 2022
a3ca14d
Fixes inspection warnings.
wrandelshofer Jun 19, 2022
275f3d3
Adds ChampMap and supporting classes.
wrandelshofer Jun 19, 2022
8318482
Adds SELF type to SetMixin.
wrandelshofer Jun 19, 2022
ae0a675
Removes debugging code in constructor.
wrandelshofer Jun 19, 2022
ed1f46a
Adds JMH benchmarks.
wrandelshofer Jun 19, 2022
f979d61
Adds LinkedChampMap and supporting classes.
wrandelshofer Jun 19, 2022
19ee2a9
Adds benchmarks.
wrandelshofer Jun 19, 2022
dbac9f6
Adds benchmarks.
wrandelshofer Jun 19, 2022
6707c4b
Updates readme file.
wrandelshofer Jun 19, 2022
9501dbf
Updates chart and JMH tests.
wrandelshofer Jun 19, 2022
8a8908f
Modularity: Moves all CHAMP classes into a separate package. Cracks v…
wrandelshofer Jun 23, 2022
9490ca2
Removes method Node.updateAll().
wrandelshofer Aug 5, 2022
c90466d
Simplifies renumber()-methods.
wrandelshofer Aug 5, 2022
e2890c8
Renames class ChampTrie to NodeFactory.
wrandelshofer Aug 5, 2022
04b9297
Fixes clear()-method.
wrandelshofer Aug 5, 2022
4a1a24f
Adds javadoc comments.
wrandelshofer Aug 5, 2022
7497033
Reduces size of code.
wrandelshofer Aug 5, 2022
9a5c180
Renames interface Sequenced to SequencedKey.
wrandelshofer Aug 6, 2022
469b779
Refactors class ChangeEvent.
wrandelshofer Aug 6, 2022
376a00d
Partially refactors 'key' to 'data' in class Node and its sub-classes.
wrandelshofer Aug 6, 2022
c38c66e
Improves javadoc. Refactors more code to improve its clarity.
wrandelshofer Aug 7, 2022
8802cb7
Adds performance tests for Kotlinx collections.
wrandelshofer Aug 7, 2022
8360dbd
Add ChampChampSet and associated classes.
wrandelshofer Apr 1, 2023
257646a
Add ChampChampMap and associated classes. (WIP)
wrandelshofer Apr 2, 2023
c173473
Clean code of Champ collections up.
wrandelshofer Apr 2, 2023
95470d9
Clean code up. Add benchmark results. Update readme.
wrandelshofer Apr 2, 2023
b22032f
Add benchmark results.
wrandelshofer Apr 3, 2023
3712df5
Add benchmark results of VavrChampSetJmh.
wrandelshofer Apr 3, 2023
793ebbd
Add benchmark results. Add more information to readme.
wrandelshofer Apr 4, 2023
b2ad2a5
Add more JMH benchmarks.
wrandelshofer Apr 21, 2023
a172f49
Revert changes in readme file.
wrandelshofer Apr 22, 2023
dfb15f6
Rename champ collection classes to HashMap, LinkedHashMap and so on.
wrandelshofer Apr 22, 2023
6e03c52
Make all tests work.
wrandelshofer Apr 23, 2023
41fa05e
Remove JMH benchmarks.
wrandelshofer Apr 23, 2023
5a51719
Make mutable collections package private.
wrandelshofer Apr 23, 2023
7cf7b6e
Revert changes in TreeMapTest.java and CodingConventions.java.
wrandelshofer Apr 23, 2023
b175889
Revert changes in AbstractMapTest.java, HashMapTest.java, LinkedHashM…
wrandelshofer Apr 23, 2023
e77718a
WIP: Replace internal representation of HashSet by a CHAMP trie.
wrandelshofer Apr 29, 2023
2f94b88
WIP: Replace internal representation of HashSet by a CHAMP trie.
wrandelshofer Apr 29, 2023
ceb2259
WIP: Add licensing info. Change file headers.
wrandelshofer Apr 30, 2023
6bbc1fd
WIP: Replace internal representation of HashMap by a CHAMP trie.
wrandelshofer Apr 30, 2023
0e19746
WIP: Replace internal representation of LinkedHashSet by a CHAMP trie.
wrandelshofer May 1, 2023
f9616e6
WIP: Replace internal representation of LinkedHashMap by a CHAMP trie.
wrandelshofer May 1, 2023
36070f4
WIP: Improve performance with transience.
wrandelshofer May 1, 2023
5c31e18
Rename 'reversed' by 'reverse' where appropriate.
wrandelshofer May 1, 2023
f1535f0
Add benchmarks.
wrandelshofer May 2, 2023
74b3d72
Add benchmarks.
wrandelshofer May 2, 2023
43b7807
Add more benchmarks.
wrandelshofer May 3, 2023
fd006a0
WIP Add bulk operations.
wrandelshofer May 7, 2023
d9cb827
Fix iteration order for HashSet.
wrandelshofer May 7, 2023
a0df14c
Implement bulk operations for HashMap and HashSet.
wrandelshofer May 7, 2023
cc67b49
Remove unintentional 'public' and 'protected' modifiers. Add benchmar…
wrandelshofer May 7, 2023
1a2505d
Fix method putAllEntries().
wrandelshofer May 7, 2023
196e584
Implement bulk operations for LinkedHashSet.
wrandelshofer May 8, 2023
0e390bb
Revert unwanted changes in this branch.
wrandelshofer May 8, 2023
5533877
Implement bulk operations in LinkedHashMap.
wrandelshofer May 10, 2023
56178a6
Replace instanceof-pattern with cast.
wrandelshofer May 10, 2023
fc68b7f
Replace record with class.
wrandelshofer May 10, 2023
8126cf4
Port code back to Java 8.
wrandelshofer May 10, 2023
8cd3e25
Remove JMH benchmarks.
wrandelshofer May 10, 2023
bfb10c8
Lump third-party licenses into a single file.
wrandelshofer May 10, 2023
8ea8a4e
Revert HashSetTest and HashMapTest.
wrandelshofer May 10, 2023
c4e3a36
Force HashSet to comply with HashSetTest.
wrandelshofer May 10, 2023
4658d2e
Revert changes in build.gradle.
wrandelshofer May 10, 2023
83ad812
Revert changes in files.
wrandelshofer May 10, 2023
2bb42b3
Revert changes in file.
wrandelshofer May 10, 2023
a039c3a
Revert formatting changes in file.
wrandelshofer May 10, 2023
d0a396e
Lump classes together.
wrandelshofer May 10, 2023
83d002a
Toggle case of licenses. The disclaimer has to be 'conspicuous' - and…
wrandelshofer May 12, 2023
fbd2d2d
Clarifying use of references in this code.
wrandelshofer May 12, 2023
ae03601
Simplify code in ChampIteration.
wrandelshofer May 12, 2023
6625007
Remove obsolete javadoc.
wrandelshofer May 12, 2023
516628f
Simplify code.
wrandelshofer May 12, 2023
54e0c28
Merge branch 'vavr-io-master'
wrandelshofer Aug 30, 2024
e235c13
Use composition instead of inheritance.
wrandelshofer Aug 30, 2024
92c285b
Fix javadoc errors.
wrandelshofer Aug 31, 2024
7b6a42c
Merge remote-tracking branch 'refs/remotes/vavr-io/master'
wrandelshofer Oct 12, 2024
49c2146
Delete empty source file.
wrandelshofer Oct 12, 2024
b562173
Rename the project from 'vavr' to 'vavr-champ' to make it clear that …
wrandelshofer Oct 13, 2024
734fc83
Replace the readme file.
wrandelshofer Oct 13, 2024
c36a33f
Fix javadoc. Commit API class.
wrandelshofer Oct 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 21 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,32 @@
# Vavr
# vavr-champ

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
[![GitHub Release](https://img.shields.io/github/release/vavr-io/vavr.svg?style=flat-square)](https://github.com/vavr-io/vavr/releases)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.vavr/vavr/badge.svg?style=flat-square)](http://search.maven.org/#search|gav|1|g:"io.vavr"%20AND%20a:"vavr")
[![Build Status](https://github.com/vavr-io/vavr/actions/workflows/build.yml/badge.svg)](https://github.com/vavr-io/vavr/actions/workflows/build.yml)
[![Code Coverage](https://codecov.io/gh/vavr-io/vavr/branch/master/graph/badge.svg)](https://codecov.io/gh/vavr-io/vavr)
vavr-champ is binary compatible with the vavr library, but uses CHAMP-based collections internally.

<p align="center">
<img src="https://user-images.githubusercontent.com/743833/62367542-486f0500-b52a-11e9-815e-e9788d4c8c8d.png" alt="Vavr's custom image"/>
</p>
For more details see the [JavaDoc](https://www.randelshofer.ch/vavr/javadoc/):

Vavr is an object-functional language extension to Java 8 that aims to reduce the number of lines of code and increase code quality.
It provides persistent collections, functional abstractions for error handling, concurrent programming, pattern matching, and much more.
- [HashMap](https://www.randelshofer.ch/vavr/javadoc/io/vavr/collection/HashMap.html)

Vavr fuses the power of object-oriented programming with the elegance and robustness of functional programming.
The most interesting part is a feature-rich, persistent collection library that smoothly integrates with Java's standard collections.
- [HashSet](https://www.randelshofer.ch/vavr/javadoc/io/vavr/collection/HashSet.html
)

Because Vavr does not depend on any libraries (other than the JVM), you can easily add it as a standalone .jar to your classpath.
- [LinkedHashMap](https://www.randelshofer.ch/vavr/javadoc/io/vavr/collection/LinkedHashMap.html)

### Stargazers over time
[![Stargazers over time](https://starchart.cc/vavr-io/vavr.svg?variant=adaptive)](https://starchart.cc/vavr-io/vavr)
- [LinkedHashSet](https://www.randelshofer.ch/vavr/javadoc/io/vavr/collection/LinkedHashSet.html)

To use it instead of the original `vavr` library, you can specify `vavr-champ` as your dependency.

## Using Vavr
Maven:

See [User Guide](http://docs.vavr.io) and/or [Javadoc](http://www.javadoc.io/doc/io.vavr/vavr).
```
<dependency>
<groupId>ch.randelshofer</groupId>
<artifactId>vavr-champ</artifactId>
<version>0.10.5</version>
</dependency>
```

### Gradle tasks:
Gradle:

* Build: `./gradlew check`
* test reports: `./build/reports/tests/test/index.html`
* coverage reports: `./build/reports/jacoco/test/html/index.html`
* Javadoc (linting): `./gradlew javadoc`

### Contributing

Currently, there are two significant branches:
- `master` (represents a stream of work leading to the release of a new major version)
- `version/0.x` (continues 0.10.4 with minor updates and bugfixes)

A small number of users have reported problems building Vavr. Read our [contribution guide](./CONTRIBUTING.md) for details.
```
implementation group: 'ch.randelshofer', name: 'vavr-champ', version: '0.10.5'
```
24 changes: 9 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ publishing {
artifact tasks.named('testSourcesJar')
pom {
name = project.name
description = "Vavr is an object-functional library for Java 8+"
description = "vavr-champ is binary compatible with vavr, but uses CHAMP-based collections internally."
url = 'https://www.vavr.io'
inceptionYear = '2014'
licenses {
Expand All @@ -170,22 +170,16 @@ publishing {
}
developers {
developer {
name = 'Daniel Dietrich'
email = '[email protected]'
organization = 'Vavr'
organizationUrl = 'https://github.com/vavr-io'
}
developer {
name = 'Grzegorz Piwowarek'
email = '[email protected]'
organization = 'Vavr'
organizationUrl = 'https://github.com/vavr-io'
name = 'Werner Randelshofer'
email = '[email protected]'
organization = 'Werner Randelshofer'
organizationUrl = 'https://www.randelshofer.ch'
}
}
scm {
connection = 'scm:git:https://github.com/vavr-io/vavr.git'
developerConnection = 'scm:git:https://github.com/vavr-io/vavr.git'
url = 'https://github.com/vavr-io/vavr/tree/master'
connection = 'scm:git:https://github.com/wrandelshofer/vavr.git'
developerConnection = 'scm:git:https://github.com/wrandelshofer/vavr.git'
url = 'https://github.com/wrandelshofer/vavr/tree/master'
}
}
}
Expand All @@ -205,7 +199,7 @@ nexusPublishing {
repositories {
sonatype {
username.set(providers.systemProperty("ossrhUsername").orElse("").forUseAtConfigurationTime())
password.set(providers.systemProperty("ossrhPassword").orElse("").forUseAtConfigurationTime())
password.set(providers.systemProperty("ossrhPassword").orElse("").forUseAtConfigurationTime())
}
}
}
Expand Down
39 changes: 39 additions & 0 deletions deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>ch.randelshofer</groupId>
<artifactId>vavr-champ</artifactId>
<version>0.10.5</version>
<packaging>jar</packaging>

<name>ch.randelshofer:vavr-champ</name>
<description>vavr-champ is binary compatible with vavr, but uses CHAMP-based collections internally.</description>
<url>https://github.com/wrandelshofer/vavr</url>

<licenses>
<license>
<name>MIT License</name>
<url>https://github.com/wrandelshofer/vavr/blob/b562173e641c75037bb8b7a3f929af997e8d3a5c/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<name>Werner Randelshofer</name>
<email>[email protected]</email>
<organization>ch.randelshofer</organization>
<organizationUrl>http://www.randelshofer.ch</organizationUrl>
</developer>
</developers>

<scm>
<connection>scm:git:git://github.com/wrandelshofer/vavr.git</connection>
<developerConnection>scm:git:ssh://github.com/wrandelshofer/vavr.git</developerConnection>
<url>https://github.com/wrandelshofer/vavr/tree/master</url>
</scm>

<dependencies/>
</project>
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = 'vavr'
rootProject.name = 'vavr-champ'
50 changes: 44 additions & 6 deletions src-gen/main/java/io/vavr/API.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,32 @@
G E N E R A T O R C R A F T E D
\*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/

import static io.vavr.API.Match.*;

import io.vavr.collection.*;
import io.vavr.collection.Array;
import io.vavr.collection.CharSeq;
import io.vavr.collection.HashMap;
import io.vavr.collection.HashSet;
import io.vavr.collection.IndexedSeq;
import io.vavr.collection.Iterator;
import io.vavr.collection.LinkedHashMap;
import io.vavr.collection.LinkedHashSet;
import io.vavr.collection.List;
import io.vavr.collection.Map;
import io.vavr.collection.PriorityQueue;
import io.vavr.collection.Queue;
import io.vavr.collection.Seq;
import io.vavr.collection.Set;
import io.vavr.collection.SortedMap;
import io.vavr.collection.SortedSet;
import io.vavr.collection.Stream;
import io.vavr.collection.TreeMap;
import io.vavr.collection.TreeSet;
import io.vavr.collection.Vector;
import io.vavr.concurrent.Future;
import io.vavr.control.Either;
import io.vavr.control.Option;
import io.vavr.control.Try;
import io.vavr.control.Validation;

import java.io.PrintStream;
import java.util.Comparator;
import java.util.Formatter;
Expand All @@ -48,6 +66,26 @@
import java.util.function.Predicate;
import java.util.function.Supplier;

import static io.vavr.API.Match.Case;
import static io.vavr.API.Match.Case0;
import static io.vavr.API.Match.Case1;
import static io.vavr.API.Match.Case2;
import static io.vavr.API.Match.Case3;
import static io.vavr.API.Match.Case4;
import static io.vavr.API.Match.Case5;
import static io.vavr.API.Match.Case6;
import static io.vavr.API.Match.Case7;
import static io.vavr.API.Match.Case8;
import static io.vavr.API.Match.Pattern0;
import static io.vavr.API.Match.Pattern1;
import static io.vavr.API.Match.Pattern2;
import static io.vavr.API.Match.Pattern3;
import static io.vavr.API.Match.Pattern4;
import static io.vavr.API.Match.Pattern5;
import static io.vavr.API.Match.Pattern6;
import static io.vavr.API.Match.Pattern7;
import static io.vavr.API.Match.Pattern8;

/**
* The most basic Vavr functionality is accessed through this API class.
*
Expand Down Expand Up @@ -6081,7 +6119,7 @@ public static final class Case0<T, R> implements Case<T, R> {
private static final long serialVersionUID = 1L;

private final Pattern0<T> pattern;
private final Function<? super T, ? extends R> f;
private transient final Function<? super T, ? extends R> f;

private Case0(Pattern0<T> pattern, Function<? super T, ? extends R> f) {
this.pattern = pattern;
Expand All @@ -6104,7 +6142,7 @@ public static final class Case1<T, T1, R> implements Case<T, R> {
private static final long serialVersionUID = 1L;

private final Pattern1<T, T1> pattern;
private final Function<? super T1, ? extends R> f;
private transient final Function<? super T1, ? extends R> f;

private Case1(Pattern1<T, T1> pattern, Function<? super T1, ? extends R> f) {
this.pattern = pattern;
Expand All @@ -6127,7 +6165,7 @@ public static final class Case2<T, T1, T2, R> implements Case<T, R> {
private static final long serialVersionUID = 1L;

private final Pattern2<T, T1, T2> pattern;
private final BiFunction<? super T1, ? super T2, ? extends R> f;
private transient final BiFunction<? super T1, ? super T2, ? extends R> f;

private Case2(Pattern2<T, T1, T2> pattern, BiFunction<? super T1, ? super T2, ? extends R> f) {
this.pattern = pattern;
Expand Down
56 changes: 56 additions & 0 deletions src/main/java/META-INF/thirdparty-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
----
capsule
https://github.com/usethesource/capsule
https://github.com/usethesource/capsule/blob/3856cd65fa4735c94bcfa94ec9ecf408429b54f4/LICENSE

BSD 2-Clause "Simplified" License

Copyright (c) Michael Steindorfer <Centrum Wiskunde & Informatica> and Contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----
JHotDraw 8
https://github.com/wrandelshofer/jhotdraw8
https://github.com/wrandelshofer/jhotdraw8/blob/c49844aebd395b6a31eb5785aa58f6b6675fac6a/LICENSE

MIT License

Copyright © 2023 The authors and contributors of JHotDraw.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
61 changes: 61 additions & 0 deletions src/main/java/io/vavr/collection/BitMappedTrie.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

import java.io.Serializable;
import java.util.NoSuchElementException;
import java.util.Spliterators;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;

Expand Down Expand Up @@ -370,6 +372,65 @@ private <U> int map(Function<? super T, ? extends U> mapper, Object results, int
}

int length() { return length; }

static class BitMappedTrieSpliterator<T> extends Spliterators.AbstractSpliterator<T> {
private final int globalLength;
private int globalIndex;

private int index;
private Object leaf;
private int length;
private final BitMappedTrie<T> root;
private T current;

public BitMappedTrieSpliterator(BitMappedTrie<T> root, int fromIndex, int characteristics) {
super(Math.max(0,root.length - fromIndex), characteristics);
this.root = root;
globalLength = root.length;
globalIndex = Math.max(0,fromIndex);
index = lastDigit(root.offset + globalIndex);
leaf = root.getLeaf(globalIndex);
length = root.type.lengthOf(leaf);
}
public boolean moveNext() {
if (globalIndex >= globalLength) {
return false;
}
if (index == length) {
setCurrentArray();
}
current = root.type.getAt(leaf, index);
index++;
globalIndex++;
return true;
}

public T current() {
return current;
}

public void skip(int count) {
globalIndex += count;
index = lastDigit(root.offset + globalIndex);
leaf = root.getLeaf(globalIndex);
length = root.type.lengthOf(leaf);
}

@Override
public boolean tryAdvance(Consumer<? super T> action) {
if (moveNext()){
action.accept(current);
return true;
}
return false;
}

private void setCurrentArray() {
index = 0;
leaf = root.getLeaf(globalIndex);
length = root.type.lengthOf(leaf);
}
}
}

@FunctionalInterface
Expand Down
Loading