Compare commits
30
Commits
9557a0cfb5
..
0.6.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26b9d6706d | ||
|
|
a21d4a9eb6 | ||
|
|
212d614ebd | ||
|
|
bcba3ccde0 | ||
|
|
b42ad76372 | ||
|
|
f95565771a | ||
|
|
3d6cbf5ac1 | ||
|
|
fc5d43e14b | ||
|
|
b3264748cd | ||
|
|
ede40f06d0 | ||
|
|
e69c675f82 | ||
|
|
17c1c90957 | ||
|
|
c6f2f71f6c | ||
|
|
d2c7c151bc | ||
|
|
4448eca787 | ||
|
|
0350a77dff | ||
|
|
4f98c599df | ||
|
|
103b2407d2 | ||
|
|
059da9be12 | ||
|
|
3cac3a997e | ||
|
|
3ffb001c73 | ||
|
|
2810a6f952 | ||
|
|
166362334b | ||
|
|
d3f9103ebf | ||
|
|
1c5507d4a5 | ||
|
|
5e3cd9f484 | ||
|
|
f27b884b6a | ||
|
|
769a9d8ea5 | ||
|
|
9499a7f0e0 | ||
|
|
ca38583f96 |
@@ -15,17 +15,19 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
jdk: [8, 11, 14, 16, 17]
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK ${{ matrix.jdk }}
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: '11'
|
java-version: ${{ matrix.jdk }}
|
||||||
distribution: 'adopt'
|
|
||||||
cache: gradle
|
|
||||||
- name: Validate Gradle wrapper
|
- name: Validate Gradle wrapper
|
||||||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
|
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
|
||||||
- name: Make gradlew executable
|
- name: Make gradlew executable
|
||||||
|
|||||||
@@ -3,6 +3,13 @@
|
|||||||
### Version 0.6.0
|
### Version 0.6.0
|
||||||
- Added: addOrGet for sets.
|
- Added: addOrGet for sets.
|
||||||
- Added: Async API which allows to easily execute Iterables/Collections offthread without the complexity.
|
- Added: Async API which allows to easily execute Iterables/Collections offthread without the complexity.
|
||||||
|
- Added: CopyOnWriteArrayList and tests for it
|
||||||
|
- Added: Support up to Java17.
|
||||||
|
- Added: Build System now adds module-info if the Running JVM is 9 or higher
|
||||||
|
- Added: ArrayList.of(Class, size) that allows you to allocate a size right at the creation of the List without having to create a wrapper array.
|
||||||
|
- Added: A ConcurrentHashMap implementation.
|
||||||
|
- Fixed: containsValue in the HashMap wouldn't check the nullKey
|
||||||
|
- Removed: Deprecated functions from SortedMaps/Sets
|
||||||
|
|
||||||
### Version 0.5.3
|
### Version 0.5.3
|
||||||
- Added: OrderedMap/Set
|
- Added: OrderedMap/Set
|
||||||
|
|||||||
@@ -7,11 +7,12 @@ It is based on Java's Collection Library and FastUtil.
|
|||||||
But its focus is a different one.
|
But its focus is a different one.
|
||||||
|
|
||||||
## Main Features:
|
## Main Features:
|
||||||
- ArrayLists / LinkedLists
|
- ArrayLists / LinkedLists / CopyOnWriteLists
|
||||||
- HashSets/Maps (Linked & HashControl)
|
- HashSets/Maps (Linked & HashControl)
|
||||||
- TreeSets/Maps (RB & AVL)
|
- TreeSets/Maps (RB & AVL)
|
||||||
- EnumMaps
|
- EnumMaps
|
||||||
- Immutable Maps/Lists/Sets
|
- Immutable Maps/Lists/Sets
|
||||||
|
- ConcurrentHashMaps
|
||||||
- Priority Queues
|
- Priority Queues
|
||||||
- Streams & Functional Queries
|
- Streams & Functional Queries
|
||||||
- SplitIterators
|
- SplitIterators
|
||||||
@@ -20,7 +21,7 @@ But its focus is a different one.
|
|||||||
- Unary/Functions
|
- Unary/Functions
|
||||||
- Suppliers
|
- Suppliers
|
||||||
- Bi/Consumers
|
- Bi/Consumers
|
||||||
|
- AsyncBuilders
|
||||||
|
|
||||||
## Current Level of Stability
|
## Current Level of Stability
|
||||||
Since this is a relatively new Library, stability was not perfect and some areas are not perfect yet.
|
Since this is a relatively new Library, stability was not perfect and some areas are not perfect yet.
|
||||||
@@ -95,13 +96,14 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'de.speiger:Primitive-Collections:0.5.3'
|
compile 'de.speiger:Primitive-Collections:0.6.0'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
Direct:
|
Direct:
|
||||||
|
|
||||||
| Version | Jar | Sources | Java Doc |
|
| Version | Jar | Sources | Java Doc |
|
||||||
|--------- |------------------------------------------------------------------------------------------------------------------------------ |-------------------------------------------------------------------------------------------------------------------------------------- |-------------------------------------------------------------------------------------------------------------------------------------- |
|
|--------- |------------------------------------------------------------------------------------------------------------------------------ |-------------------------------------------------------------------------------------------------------------------------------------- |-------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| 0.6.0 | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.6.0/Primitive-Collections-0.6.0.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.6.0/Primitive-Collections-0.6.0-sources.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.6.0/Primitive-Collections-0.6.0-javadoc.jar) |
|
||||||
| 0.5.3 | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.3/Primitive-Collections-0.5.3.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.3/Primitive-Collections-0.5.3-sources.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.3/Primitive-Collections-0.5.3-javadoc.jar) |
|
| 0.5.3 | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.3/Primitive-Collections-0.5.3.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.3/Primitive-Collections-0.5.3-sources.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.3/Primitive-Collections-0.5.3-javadoc.jar) |
|
||||||
| 0.5.2 | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.2/Primitive-Collections-0.5.2.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.2/Primitive-Collections-0.5.2-sources.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.2/Primitive-Collections-0.5.2-javadoc.jar) |
|
| 0.5.2 | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.2/Primitive-Collections-0.5.2.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.2/Primitive-Collections-0.5.2-sources.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.2/Primitive-Collections-0.5.2-javadoc.jar) |
|
||||||
| 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) |
|
| 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) |
|
||||||
|
|||||||
+32
-17
@@ -8,7 +8,7 @@ tasks.withType(JavaCompile) {
|
|||||||
|
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
apply plugin: 'maven'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -18,9 +18,11 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
archivesBaseName = 'Primitive Collections'
|
archivesBaseName = 'Primitive Collections'
|
||||||
version = '0.5.3';
|
version = '0.6.0';
|
||||||
|
|
||||||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaVersion.current();
|
||||||
|
|
||||||
|
System.out.println("Java Version: "+compileJava.sourceCompatibility)
|
||||||
|
|
||||||
javadoc {
|
javadoc {
|
||||||
options.tags = [ "implSpec", "note" ]
|
options.tags = [ "implSpec", "note" ]
|
||||||
@@ -42,8 +44,7 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
builderCompile 'de.speiger:Simple-Code-Generator:1.0.6'
|
builderImplementation 'de.speiger:Simple-Code-Generator:1.0.7'
|
||||||
runtimeOnly 'de.speiger:Simple-Code-Generator:1.0.6'
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation 'com.google.guava:guava-testlib:31.0.1-jre'
|
testImplementation 'com.google.guava:guava-testlib:31.0.1-jre'
|
||||||
}
|
}
|
||||||
@@ -94,24 +95,23 @@ test {
|
|||||||
useJUnit()
|
useJUnit()
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadArchives {
|
publishing {
|
||||||
Properties props = new Properties()
|
Properties props = new Properties()
|
||||||
if(file("$buildDir/credentials.properties").exists())
|
if(file("$buildDir/credentials.properties").exists()) {
|
||||||
{
|
|
||||||
props.load(new FileInputStream("$buildDir/credentials.properties"))
|
props.load(new FileInputStream("$buildDir/credentials.properties"))
|
||||||
}
|
}
|
||||||
repositories.mavenDeployer {
|
publications {
|
||||||
repository(url: 'https://maven.speiger.com/repository/main') {
|
mavenJava(MavenPublication) {
|
||||||
authentication(userName: props.mavenUser, password: props.mavenPassword)
|
|
||||||
}
|
|
||||||
snapshotRepository(url: 'https://maven.speiger.com/repository/main') {
|
|
||||||
authentication(userName: props.mavenUser, password: props.mavenPassword)
|
|
||||||
}
|
|
||||||
pom {
|
pom {
|
||||||
|
name = 'Primitive Collections'
|
||||||
|
description = 'A Primitive Collection library that reduces memory usage and improves performance'
|
||||||
|
url = 'https://github.com/Speiger/Primitive-Collections'
|
||||||
version = project.version
|
version = project.version
|
||||||
artifactId = project.archivesBaseName.replace(" ", "-")
|
artifactId = project.archivesBaseName.replace(" ", "-")
|
||||||
groupId = 'de.speiger'
|
groupId = 'de.speiger'
|
||||||
project {
|
from components.java
|
||||||
|
artifact tasks.srcJar
|
||||||
|
artifact tasks.javadocJar
|
||||||
licenses {
|
licenses {
|
||||||
license {
|
license {
|
||||||
name = 'The Apache License, Version 2.0'
|
name = 'The Apache License, Version 2.0'
|
||||||
@@ -122,10 +122,25 @@ uploadArchives {
|
|||||||
developer {
|
developer {
|
||||||
id = 'speiger'
|
id = 'speiger'
|
||||||
name = 'Speiger'
|
name = 'Speiger'
|
||||||
email = 'speiger@gmx.net'
|
}
|
||||||
|
}
|
||||||
|
scm {
|
||||||
|
url = 'https://github.com/Speiger/Primitive-Collections'
|
||||||
|
}
|
||||||
|
issueManagement {
|
||||||
|
system = 'github'
|
||||||
|
url = 'https://github.com/Speiger/Primitive-Collections/issues'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url version.endsWith('SNAPSHOT') ? "https://maven.speiger.com/repository/debug" : "https://maven.speiger.com/repository/main"
|
||||||
|
credentials(PasswordCredentials) {
|
||||||
|
username props.mavenUser
|
||||||
|
password props.mavenPassword
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
jdk:
|
||||||
|
- openjdk9
|
||||||
|
install:
|
||||||
|
- chmod +x ./gradlew
|
||||||
|
- ./gradlew generateGithubSource
|
||||||
|
- ./gradlew build publishToMavenLocal
|
||||||
|
|
||||||
@@ -158,6 +158,7 @@ public class GlobalVariables
|
|||||||
|
|
||||||
//Final Classes
|
//Final Classes
|
||||||
addClassMapper("ARRAY_LIST", "ArrayList");
|
addClassMapper("ARRAY_LIST", "ArrayList");
|
||||||
|
addAbstractMapper("COPY_ON_WRITE_LIST", "CopyOnWrite%sArrayList");
|
||||||
addClassMapper("ASYNC_BUILDER", "AsyncBuilder");
|
addClassMapper("ASYNC_BUILDER", "AsyncBuilder");
|
||||||
addClassMapper("LINKED_LIST", "LinkedList");
|
addClassMapper("LINKED_LIST", "LinkedList");
|
||||||
addAbstractMapper("IMMUTABLE_LIST", "Immutable%sList");
|
addAbstractMapper("IMMUTABLE_LIST", "Immutable%sList");
|
||||||
@@ -173,6 +174,7 @@ public class GlobalVariables
|
|||||||
addBiClassMapper("LINKED_CUSTOM_HASH_MAP", "LinkedOpenCustomHashMap", "2");
|
addBiClassMapper("LINKED_CUSTOM_HASH_MAP", "LinkedOpenCustomHashMap", "2");
|
||||||
addBiClassMapper("LINKED_HASH_MAP", "LinkedOpenHashMap", "2");
|
addBiClassMapper("LINKED_HASH_MAP", "LinkedOpenHashMap", "2");
|
||||||
addBiClassMapper("CUSTOM_HASH_MAP", "OpenCustomHashMap", "2");
|
addBiClassMapper("CUSTOM_HASH_MAP", "OpenCustomHashMap", "2");
|
||||||
|
addBiClassMapper("CONCURRENT_HASH_MAP", "ConcurrentOpenHashMap", "2");
|
||||||
addBiClassMapper("AVL_TREE_MAP", "AVLTreeMap", "2");
|
addBiClassMapper("AVL_TREE_MAP", "AVLTreeMap", "2");
|
||||||
addBiClassMapper("RB_TREE_MAP", "RBTreeMap", "2");
|
addBiClassMapper("RB_TREE_MAP", "RBTreeMap", "2");
|
||||||
addFunctionValueMappers("LINKED_ENUM_MAP", valueType.isObject() ? "LinkedEnum2ObjectMap" : "LinkedEnum2%sMap");
|
addFunctionValueMappers("LINKED_ENUM_MAP", valueType.isObject() ? "LinkedEnum2ObjectMap" : "LinkedEnum2%sMap");
|
||||||
@@ -222,6 +224,7 @@ public class GlobalVariables
|
|||||||
addBiClassMapper("NAVIGABLE_MAP", "NavigableMap", "2");
|
addBiClassMapper("NAVIGABLE_MAP", "NavigableMap", "2");
|
||||||
addBiClassMapper("ORDERED_MAP", "OrderedMap", "2");
|
addBiClassMapper("ORDERED_MAP", "OrderedMap", "2");
|
||||||
addBiClassMapper("SORTED_MAP", "SortedMap", "2");
|
addBiClassMapper("SORTED_MAP", "SortedMap", "2");
|
||||||
|
addBiClassMapper("CONCURRENT_MAP", "ConcurrentMap", "2");
|
||||||
addBiClassMapper("MAP", "Map", "2");
|
addBiClassMapper("MAP", "Map", "2");
|
||||||
addClassMapper("NAVIGABLE_SET", "NavigableSet");
|
addClassMapper("NAVIGABLE_SET", "NavigableSet");
|
||||||
addBiClassMapper("PAIR", "Pair", "");
|
addBiClassMapper("PAIR", "Pair", "");
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package speiger.src.builder;
|
package speiger.src.builder;
|
||||||
|
|
||||||
|
import java.io.BufferedWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -10,7 +12,9 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.StringJoiner;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import speiger.src.builder.processor.TemplateProcess;
|
import speiger.src.builder.processor.TemplateProcess;
|
||||||
import speiger.src.builder.processor.TemplateProcessor;
|
import speiger.src.builder.processor.TemplateProcessor;
|
||||||
@@ -65,6 +69,23 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void afterFinish()
|
||||||
|
{
|
||||||
|
if(getVersion() > 8)
|
||||||
|
{
|
||||||
|
Path basePath = Paths.get("src/main/java");
|
||||||
|
try(BufferedWriter writer = Files.newBufferedWriter(basePath.resolve("module-info.java")))
|
||||||
|
{
|
||||||
|
writer.write(getModuleInfo(basePath));
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init()
|
protected void init()
|
||||||
{
|
{
|
||||||
@@ -83,7 +104,7 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor
|
|||||||
biRequired.put("Pair", "");
|
biRequired.put("Pair", "");
|
||||||
biRequired.put("MutablePair", "");
|
biRequired.put("MutablePair", "");
|
||||||
biRequired.put("ImmutablePair", "");
|
biRequired.put("ImmutablePair", "");
|
||||||
addBiClass("Function", "Maps", "Map", "SortedMap", "OrderedMap", "NavigableMap", "AbstractMap", "ImmutableOpenHashMap", "OpenHashMap", "LinkedOpenHashMap", "OpenCustomHashMap", "LinkedOpenCustomHashMap", "ArrayMap", "RBTreeMap", "AVLTreeMap");
|
addBiClass("Function", "Maps", "Map", "SortedMap", "OrderedMap", "NavigableMap", "ConcurrentMap", "AbstractMap", "ConcurrentOpenHashMap", "ImmutableOpenHashMap", "OpenHashMap", "LinkedOpenHashMap", "OpenCustomHashMap", "LinkedOpenCustomHashMap", "ArrayMap", "RBTreeMap", "AVLTreeMap");
|
||||||
nameRemapper.put("BiConsumer", "%sConsumer");
|
nameRemapper.put("BiConsumer", "%sConsumer");
|
||||||
nameRemapper.put("IArray", "I%sArray");
|
nameRemapper.put("IArray", "I%sArray");
|
||||||
nameRemapper.put("AbstractMap", "Abstract%sMap");
|
nameRemapper.put("AbstractMap", "Abstract%sMap");
|
||||||
@@ -94,12 +115,13 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor
|
|||||||
nameRemapper.put("EnumMap", "Enum2%sMap");
|
nameRemapper.put("EnumMap", "Enum2%sMap");
|
||||||
nameRemapper.put("LinkedEnumMap", "LinkedEnum2%sMap");
|
nameRemapper.put("LinkedEnumMap", "LinkedEnum2%sMap");
|
||||||
nameRemapper.put("ImmutableList", "Immutable%sList");
|
nameRemapper.put("ImmutableList", "Immutable%sList");
|
||||||
|
nameRemapper.put("CopyOnWriteList", "CopyOnWrite%sArrayList");
|
||||||
nameRemapper.put("ImmutableOpenHashSet", "Immutable%sOpenHashSet");
|
nameRemapper.put("ImmutableOpenHashSet", "Immutable%sOpenHashSet");
|
||||||
nameRemapper.put("ImmutableOpenHashMap", "Immutable%sOpenHashMap");
|
nameRemapper.put("ImmutableOpenHashMap", "Immutable%sOpenHashMap");
|
||||||
|
|
||||||
addBlockage(ClassType.OBJECT, "Consumer", "Comparator", "Stack");
|
addBlockage(ClassType.OBJECT, "Consumer", "Comparator", "Stack");
|
||||||
addBlockage(ClassType.BOOLEAN, "ArraySet", "AVLTreeSet", "RBTreeSet", "SortedSet", "OrderedSet", "NavigableSet", "OpenHashSet", "OpenCustomHashSet", "LinkedOpenHashSet", "LinkedOpenCustomHashSet");
|
addBlockage(ClassType.BOOLEAN, "ArraySet", "AVLTreeSet", "RBTreeSet", "SortedSet", "OrderedSet", "NavigableSet", "OpenHashSet", "OpenCustomHashSet", "LinkedOpenHashSet", "LinkedOpenCustomHashSet");
|
||||||
addBlockage(ClassType.BOOLEAN, "ImmutableOpenHashMap", "ImmutableOpenHashSet", "SortedMap", "OrderedMap", "NavigableMap", "OpenHashMap", "LinkedOpenHashMap", "OpenCustomHashMap", "LinkedOpenCustomHashMap", "ArrayMap", "RBTreeMap", "AVLTreeMap");
|
addBlockage(ClassType.BOOLEAN, "ConcurrentOpenHashMap", "ImmutableOpenHashMap", "ImmutableOpenHashSet", "SortedMap", "OrderedMap", "NavigableMap", "ConcurrentMap", "OpenHashMap", "LinkedOpenHashMap", "OpenCustomHashMap", "LinkedOpenCustomHashMap", "ArrayMap", "RBTreeMap", "AVLTreeMap");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void create(ClassType mainType, ClassType subType)
|
protected void create(ClassType mainType, ClassType subType)
|
||||||
@@ -161,6 +183,55 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor
|
|||||||
return variables;
|
return variables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getModuleInfo(Path basePath) {
|
||||||
|
StringJoiner joiner = new StringJoiner("\n", "", "\n");
|
||||||
|
try(Stream<Path> stream = Files.walk(getOutputFolder()))
|
||||||
|
{
|
||||||
|
stream.filter(Files::isDirectory)
|
||||||
|
.filter(this::containsFiles)
|
||||||
|
.map(basePath::relativize)
|
||||||
|
.map(Path::toString)
|
||||||
|
.map(this::sanitize)
|
||||||
|
.forEach(T -> joiner.add("\texports "+T+";"));
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("/** @author Speiger */\n");
|
||||||
|
builder.append("module ").append(sanitize(basePath.relativize(getOutputFolder()).toString())).append(" {\n");
|
||||||
|
builder.append(joiner.toString()).append("}");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String sanitize(String input)
|
||||||
|
{
|
||||||
|
return input.replace("\\", ".").replace("/", ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean containsFiles(Path path)
|
||||||
|
{
|
||||||
|
try(Stream<Path> stream = Files.walk(path, 1))
|
||||||
|
{
|
||||||
|
return stream.filter(Files::isRegularFile).findFirst().isPresent();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getVersion()
|
||||||
|
{
|
||||||
|
String version = System.getProperty("java.version");
|
||||||
|
if(version.startsWith("1.")) return Integer.parseInt(version.substring(2, 3));
|
||||||
|
int dot = version.indexOf(".");
|
||||||
|
return Integer.parseInt(dot != -1 ? version.substring(0, dot) : version);
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String...args)
|
public static void main(String...args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
-2
@@ -7,7 +7,6 @@ import java.util.AbstractCollection;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
import speiger.src.collections.PACKAGE.collections.COLLECTION;
|
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
import speiger.src.collections.PACKAGE.utils.ITERATORS;
|
import speiger.src.collections.PACKAGE.utils.ITERATORS;
|
||||||
@@ -100,7 +99,6 @@ public abstract class ABSTRACT_COLLECTION KEY_GENERIC_TYPE extends AbstractColle
|
|||||||
* This implementation iterates over the elements of the collection and checks if they are stored in this collection
|
* This implementation iterates over the elements of the collection and checks if they are stored in this collection
|
||||||
* @param c the elements that should be checked for
|
* @param c the elements that should be checked for
|
||||||
* @return true if any element is in this collection
|
* @return true if any element is in this collection
|
||||||
* @deprecated if this is a primitive collection
|
|
||||||
* @throws java.lang.NullPointerException if the collection is null
|
* @throws java.lang.NullPointerException if the collection is null
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
-1
@@ -14,7 +14,6 @@ import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION;
|
|||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
|
import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
|
||||||
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
|
|
||||||
import speiger.src.collections.PACKAGE.lists.LIST;
|
import speiger.src.collections.PACKAGE.lists.LIST;
|
||||||
import speiger.src.collections.PACKAGE.lists.ARRAY_LIST;
|
import speiger.src.collections.PACKAGE.lists.ARRAY_LIST;
|
||||||
#if !TYPE_BOOLEAN
|
#if !TYPE_BOOLEAN
|
||||||
|
|||||||
+4
@@ -50,6 +50,10 @@ public interface COMPARATOR extends Comparator<CLASS_TYPE>
|
|||||||
{
|
{
|
||||||
COMPARATOR original;
|
COMPARATOR original;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* default constructor
|
||||||
|
* @param original that is going to be reversed
|
||||||
|
*/
|
||||||
public Reversed(COMPARATOR original) {
|
public Reversed(COMPARATOR original) {
|
||||||
this.original = original;
|
this.original = original;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -75,7 +75,7 @@ public abstract class ABSTRACT_LIST KEY_GENERIC_TYPE extends ABSTRACT_COLLECTION
|
|||||||
* The IndexOf implementation iterates over all elements and compares them to the search value.
|
* The IndexOf implementation iterates over all elements and compares them to the search value.
|
||||||
* @param o the value that the index is searched for.
|
* @param o the value that the index is searched for.
|
||||||
* @return index of the value that was searched for. -1 if not found
|
* @return index of the value that was searched for. -1 if not found
|
||||||
* @deprecated it is highly suggested not to use this with Primitives because of boxing. But it is still supported because of ObjectComparason that are custom objects and allow to find the contents.
|
* @note it is highly suggested not to use this with Primitives because of boxing. But it is still supported because of ObjectComparason that are custom objects and allow to find the contents.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Primitive
|
@Primitive
|
||||||
@@ -103,7 +103,7 @@ public abstract class ABSTRACT_LIST KEY_GENERIC_TYPE extends ABSTRACT_COLLECTION
|
|||||||
* The lastIndexOf implementation iterates over all elements and compares them to the search value.
|
* The lastIndexOf implementation iterates over all elements and compares them to the search value.
|
||||||
* @param o the value that the index is searched for.
|
* @param o the value that the index is searched for.
|
||||||
* @return the last index of the value that was searched for. -1 if not found
|
* @return the last index of the value that was searched for. -1 if not found
|
||||||
* @deprecated it is highly suggested not to use this with Primitives because of boxing. But it is still supported because of ObjectComparason that are custom objects and allow to find the contents.
|
* @note it is highly suggested not to use this with Primitives because of boxing. But it is still supported because of ObjectComparason that are custom objects and allow to find the contents.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Primitive
|
@Primitive
|
||||||
|
|||||||
+14
-1
@@ -188,12 +188,25 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new ArrayList with a EmptyObject array of the Type requested
|
||||||
|
* @param c the type of the array
|
||||||
|
* @param size the initial size of the backing array
|
||||||
|
* @Type(T)
|
||||||
|
* @return a typed List
|
||||||
|
*/
|
||||||
|
public static GENERIC_KEY_BRACES ARRAY_LIST KEY_GENERIC_TYPE of(Class<KEY_TYPE> c, int size) {
|
||||||
|
ARRAY_LIST KEY_GENERIC_TYPE list = new ARRAY_LISTBRACES();
|
||||||
|
list.data = (KEY_TYPE[])ObjectArrays.newArray(c, size);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* Appends the specified element to the end of this list.
|
* Appends the specified element to the end of this list.
|
||||||
*
|
*
|
||||||
* @param e element to be appended to this list
|
* @param e element to be appended to this list
|
||||||
* @return <tt>true</tt> (as specified by {@link Collection#add})
|
* @return true (as specified by {@link Collection#add})
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean add(KEY_TYPE e) {
|
public boolean add(KEY_TYPE e) {
|
||||||
|
|||||||
+1788
File diff suppressed because it is too large
Load Diff
+2415
File diff suppressed because it is too large
Load Diff
+4
-45
@@ -1,7 +1,6 @@
|
|||||||
package speiger.src.collections.PACKAGE.maps.impl.customHash;
|
package speiger.src.collections.PACKAGE.maps.impl.customHash;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@@ -10,7 +9,6 @@ import java.util.Objects;
|
|||||||
|
|
||||||
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
@@ -22,9 +20,8 @@ import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR;
|
|||||||
import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR;
|
import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR;
|
||||||
import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
|
import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
|
||||||
import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP;
|
import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP;
|
||||||
import speiger.src.collections.PACKAGE.maps.interfaces.SORTED_MAP;
|
|
||||||
import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET;
|
import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET;
|
||||||
import speiger.src.collections.PACKAGE.sets.SORTED_SET;
|
import speiger.src.collections.PACKAGE.sets.ORDERED_SET;
|
||||||
import speiger.src.collections.PACKAGE.sets.SET;
|
import speiger.src.collections.PACKAGE.sets.SET;
|
||||||
import speiger.src.collections.PACKAGE.utils.STRATEGY;
|
import speiger.src.collections.PACKAGE.utils.STRATEGY;
|
||||||
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION;
|
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION;
|
||||||
@@ -60,7 +57,6 @@ import speiger.src.collections.objects.functions.function.ObjectObjectUnaryOpera
|
|||||||
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
|
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
|
||||||
import speiger.src.collections.objects.lists.ObjectListIterator;
|
import speiger.src.collections.objects.lists.ObjectListIterator;
|
||||||
import speiger.src.collections.objects.sets.AbstractObjectSet;
|
import speiger.src.collections.objects.sets.AbstractObjectSet;
|
||||||
import speiger.src.collections.objects.sets.ObjectSortedSet;
|
|
||||||
import speiger.src.collections.objects.sets.ObjectSet;
|
import speiger.src.collections.objects.sets.ObjectSet;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.utils.HashUtil;
|
import speiger.src.collections.utils.HashUtil;
|
||||||
@@ -72,7 +68,7 @@ import speiger.src.collections.utils.HashUtil;
|
|||||||
* @Type(T)
|
* @Type(T)
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
*/
|
*/
|
||||||
public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE implements SORTED_MAP KEY_VALUE_GENERIC_TYPE, ORDERED_MAP KEY_VALUE_GENERIC_TYPE
|
public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE implements ORDERED_MAP KEY_VALUE_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
/** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */
|
/** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */
|
||||||
protected transient long[] links;
|
protected transient long[] links;
|
||||||
@@ -364,20 +360,6 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE FIRST_ENTRY_KEY() {
|
public KEY_TYPE FIRST_ENTRY_KEY() {
|
||||||
if(size == 0) throw new NoSuchElementException();
|
if(size == 0) throw new NoSuchElementException();
|
||||||
@@ -621,7 +603,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
|||||||
values = newValues;
|
values = newValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MapEntrySet extends AbstractObjectSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> implements SORTED_MAP.FastSortedSet KEY_VALUE_GENERIC_TYPE {
|
private class MapEntrySet extends AbstractObjectSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> implements ORDERED_MAP.FastOrderedSet KEY_VALUE_GENERIC_TYPE {
|
||||||
@Override
|
@Override
|
||||||
public boolean addAndMoveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); }
|
public boolean addAndMoveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
@@ -861,20 +843,9 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
|||||||
public void clear() {
|
public void clear() {
|
||||||
LINKED_CUSTOM_HASH_MAP.this.clear();
|
LINKED_CUSTOM_HASH_MAP.this.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Comparator<MAP.Entry KEY_VALUE_GENERIC_TYPE> comparator() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> subSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement, MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> headSet(MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> tailSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement) { throw new UnsupportedOperationException(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE {
|
private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE {
|
||||||
#if TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@@ -1093,18 +1064,6 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Values extends VALUE_ABSTRACT_COLLECTION VALUE_GENERIC_TYPE {
|
private class Values extends VALUE_ABSTRACT_COLLECTION VALUE_GENERIC_TYPE {
|
||||||
|
|||||||
+7
-1
@@ -316,6 +316,7 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
|||||||
#if !VALUE_OBJECT
|
#if !VALUE_OBJECT
|
||||||
@Override
|
@Override
|
||||||
public boolean containsValue(VALUE_TYPE value) {
|
public boolean containsValue(VALUE_TYPE value) {
|
||||||
|
if(containsNull && VALUE_EQUALS(values[nullIndex], value)) return true;
|
||||||
for(int i = nullIndex;i >= 0;i--)
|
for(int i = nullIndex;i >= 0;i--)
|
||||||
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && VALUE_EQUALS(values[i], value)) return true;
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && VALUE_EQUALS(values[i], value)) return true;
|
||||||
return false;
|
return false;
|
||||||
@@ -325,7 +326,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
|||||||
@Override
|
@Override
|
||||||
@ValuePrimitive
|
@ValuePrimitive
|
||||||
public boolean containsValue(Object value) {
|
public boolean containsValue(Object value) {
|
||||||
for(int i = nullIndex;i >= 0;i--)
|
#if VALUE_OBJECT
|
||||||
|
if(containsNull && VALUE_EQUALS(values[nullIndex], value)) return true;
|
||||||
|
#else
|
||||||
|
if(containsNull && ((value == null && values[nullIndex] == getDefaultReturnValue()) || EQUALS_VALUE_TYPE(values[nullIndex], value))) return true;
|
||||||
|
#endif
|
||||||
|
for(int i = nullIndex-1;i >= 0;i--)
|
||||||
#if VALUE_OBJECT
|
#if VALUE_OBJECT
|
||||||
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && EQUALS_VALUE_TYPE(values[i], value)) return true;
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && EQUALS_VALUE_TYPE(values[i], value)) return true;
|
||||||
#else
|
#else
|
||||||
|
|||||||
+6
-50
@@ -1,7 +1,6 @@
|
|||||||
package speiger.src.collections.PACKAGE.maps.impl.hash;
|
package speiger.src.collections.PACKAGE.maps.impl.hash;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@@ -10,7 +9,6 @@ import java.util.Objects;
|
|||||||
|
|
||||||
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
@@ -21,10 +19,9 @@ import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
|||||||
import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR;
|
import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR;
|
||||||
import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR;
|
import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR;
|
||||||
import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
|
import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
|
||||||
import speiger.src.collections.PACKAGE.maps.interfaces.SORTED_MAP;
|
|
||||||
import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP;
|
import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP;
|
||||||
import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET;
|
import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET;
|
||||||
import speiger.src.collections.PACKAGE.sets.SORTED_SET;
|
import speiger.src.collections.PACKAGE.sets.ORDERED_SET;
|
||||||
import speiger.src.collections.PACKAGE.sets.SET;
|
import speiger.src.collections.PACKAGE.sets.SET;
|
||||||
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION;
|
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION;
|
||||||
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION;
|
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION;
|
||||||
@@ -59,7 +56,6 @@ import speiger.src.collections.objects.functions.function.ObjectObjectUnaryOpera
|
|||||||
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
|
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
|
||||||
import speiger.src.collections.objects.lists.ObjectListIterator;
|
import speiger.src.collections.objects.lists.ObjectListIterator;
|
||||||
import speiger.src.collections.objects.sets.AbstractObjectSet;
|
import speiger.src.collections.objects.sets.AbstractObjectSet;
|
||||||
import speiger.src.collections.objects.sets.ObjectSortedSet;
|
|
||||||
import speiger.src.collections.objects.sets.ObjectSet;
|
import speiger.src.collections.objects.sets.ObjectSet;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.utils.HashUtil;
|
import speiger.src.collections.utils.HashUtil;
|
||||||
@@ -71,7 +67,7 @@ import speiger.src.collections.utils.HashUtil;
|
|||||||
* @Type(T)
|
* @Type(T)
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
*/
|
*/
|
||||||
public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_GENERIC_TYPE implements SORTED_MAP KEY_VALUE_GENERIC_TYPE, ORDERED_MAP KEY_VALUE_GENERIC_TYPE
|
public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_GENERIC_TYPE implements ORDERED_MAP KEY_VALUE_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
/** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */
|
/** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */
|
||||||
protected transient long[] links;
|
protected transient long[] links;
|
||||||
@@ -368,20 +364,6 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE FIRST_ENTRY_KEY() {
|
public KEY_TYPE FIRST_ENTRY_KEY() {
|
||||||
if(size == 0) throw new NoSuchElementException();
|
if(size == 0) throw new NoSuchElementException();
|
||||||
@@ -625,7 +607,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
|||||||
values = newValues;
|
values = newValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MapEntrySet extends AbstractObjectSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> implements SORTED_MAP.FastSortedSet KEY_VALUE_GENERIC_TYPE {
|
private class MapEntrySet extends AbstractObjectSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> implements ORDERED_MAP.FastOrderedSet KEY_VALUE_GENERIC_TYPE {
|
||||||
@Override
|
@Override
|
||||||
public boolean addAndMoveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); }
|
public boolean addAndMoveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
@@ -862,20 +844,9 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
|||||||
public void clear() {
|
public void clear() {
|
||||||
LINKED_HASH_MAP.this.clear();
|
LINKED_HASH_MAP.this.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Comparator<MAP.Entry KEY_VALUE_GENERIC_TYPE> comparator() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> subSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement, MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> headSet(MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> tailSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement) { throw new UnsupportedOperationException(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE {
|
private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE {
|
||||||
#if TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@@ -905,9 +876,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
@Override
|
@Override
|
||||||
public boolean add(KEY_TYPE o) {
|
public boolean add(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
||||||
@@ -1089,23 +1058,11 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
|||||||
int result = 0;
|
int result = 0;
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1){
|
while(index != -1){
|
||||||
if(filter.TEST_VALUE(keys[index])) return result++;
|
if(filter.TEST_VALUE(keys[index])) result++;
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Values extends VALUE_ABSTRACT_COLLECTION VALUE_GENERIC_TYPE {
|
private class Values extends VALUE_ABSTRACT_COLLECTION VALUE_GENERIC_TYPE {
|
||||||
@@ -1371,7 +1328,6 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(VALUE_TYPE e) { throw new UnsupportedOperationException(); }
|
public void add(VALUE_TYPE e) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MapIterator {
|
private class MapIterator {
|
||||||
|
|||||||
+8
-2
@@ -287,7 +287,8 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
|||||||
#if !VALUE_OBJECT
|
#if !VALUE_OBJECT
|
||||||
@Override
|
@Override
|
||||||
public boolean containsValue(VALUE_TYPE value) {
|
public boolean containsValue(VALUE_TYPE value) {
|
||||||
for(int i = nullIndex;i >= 0;i--)
|
if(containsNull && VALUE_EQUALS(values[nullIndex], value)) return true;
|
||||||
|
for(int i = nullIndex-1;i >= 0;i--)
|
||||||
if(KEY_EQUALS_NOT_NULL(keys[i]) && VALUE_EQUALS(values[i], value)) return true;
|
if(KEY_EQUALS_NOT_NULL(keys[i]) && VALUE_EQUALS(values[i], value)) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -296,7 +297,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
|||||||
@Override
|
@Override
|
||||||
@ValuePrimitive
|
@ValuePrimitive
|
||||||
public boolean containsValue(Object value) {
|
public boolean containsValue(Object value) {
|
||||||
for(int i = nullIndex;i >= 0;i--)
|
#if VALUE_OBJECT
|
||||||
|
if(containsNull && VALUE_EQUALS(values[nullIndex], value)) return true;
|
||||||
|
#else
|
||||||
|
if(containsNull && ((value == null && values[nullIndex] == getDefaultReturnValue()) || EQUALS_VALUE_TYPE(values[nullIndex], value))) return true;
|
||||||
|
#endif
|
||||||
|
for(int i = nullIndex-1;i >= 0;i--)
|
||||||
#if VALUE_OBJECT
|
#if VALUE_OBJECT
|
||||||
if(KEY_EQUALS_NOT_NULL(keys[i]) && EQUALS_VALUE_TYPE(values[i], value)) return true;
|
if(KEY_EQUALS_NOT_NULL(keys[i]) && EQUALS_VALUE_TYPE(values[i], value)) return true;
|
||||||
#else
|
#else
|
||||||
|
|||||||
+4
-40
@@ -1,7 +1,6 @@
|
|||||||
package speiger.src.collections.PACKAGE.maps.impl.immutable;
|
package speiger.src.collections.PACKAGE.maps.impl.immutable;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -11,7 +10,6 @@ import java.util.function.BiFunction;
|
|||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !TYPE_OBJECT && !VALUE_BOOLEAN
|
#if !TYPE_OBJECT && !VALUE_BOOLEAN
|
||||||
@@ -24,11 +22,10 @@ import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
|
|||||||
import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR;
|
import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR;
|
import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR;
|
||||||
import speiger.src.collections.PACKAGE.maps.interfaces.SORTED_MAP;
|
|
||||||
import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP;
|
import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP;
|
||||||
import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP;
|
import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP;
|
||||||
import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
|
import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
|
||||||
import speiger.src.collections.PACKAGE.sets.SORTED_SET;
|
import speiger.src.collections.PACKAGE.sets.ORDERED_SET;
|
||||||
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
|
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.utils.ARRAYS;
|
import speiger.src.collections.PACKAGE.utils.ARRAYS;
|
||||||
@@ -71,7 +68,6 @@ import speiger.src.collections.objects.functions.function.ObjectObjectUnaryOpera
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.objects.lists.ObjectListIterator;
|
import speiger.src.collections.objects.lists.ObjectListIterator;
|
||||||
import speiger.src.collections.objects.sets.ObjectSortedSet;
|
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.objects.sets.AbstractObjectSet;
|
import speiger.src.collections.objects.sets.AbstractObjectSet;
|
||||||
import speiger.src.collections.objects.sets.ObjectSet;
|
import speiger.src.collections.objects.sets.ObjectSet;
|
||||||
@@ -85,7 +81,7 @@ import speiger.src.collections.utils.SanityChecks;
|
|||||||
* @Type(T)
|
* @Type(T)
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
*/
|
*/
|
||||||
public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE implements SORTED_MAP KEY_VALUE_GENERIC_TYPE, ORDERED_MAP KEY_VALUE_GENERIC_TYPE
|
public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE implements ORDERED_MAP KEY_VALUE_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
/** The Backing keys array */
|
/** The Backing keys array */
|
||||||
protected transient KEY_TYPE[] keys;
|
protected transient KEY_TYPE[] keys;
|
||||||
@@ -465,15 +461,6 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; }
|
|
||||||
@Override
|
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void forEach(BI_CONSUMER KEY_VALUE_GENERIC_TYPE action) {
|
public void forEach(BI_CONSUMER KEY_VALUE_GENERIC_TYPE action) {
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
@@ -597,7 +584,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MapEntrySet extends AbstractObjectSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> implements SORTED_MAP.FastSortedSet KEY_VALUE_GENERIC_TYPE {
|
private class MapEntrySet extends AbstractObjectSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> implements ORDERED_MAP.FastOrderedSet KEY_VALUE_GENERIC_TYPE {
|
||||||
@Override
|
@Override
|
||||||
public boolean addAndMoveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); }
|
public boolean addAndMoveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
@@ -810,20 +797,9 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear() { throw new UnsupportedOperationException(); }
|
public void clear() { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
@Override
|
|
||||||
public Comparator<MAP.Entry KEY_VALUE_GENERIC_TYPE> comparator() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> subSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement, MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> headSet(MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> tailSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement) { throw new UnsupportedOperationException(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE {
|
private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE {
|
||||||
#if TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@@ -1024,18 +1000,6 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Values extends VALUE_ABSTRACT_COLLECTION VALUE_GENERIC_TYPE {
|
private class Values extends VALUE_ABSTRACT_COLLECTION VALUE_GENERIC_TYPE {
|
||||||
|
|||||||
+7
-1128
File diff suppressed because it is too large
Load Diff
+4
-44
@@ -1,6 +1,5 @@
|
|||||||
package speiger.src.collections.PACKAGE.maps.impl.misc;
|
package speiger.src.collections.PACKAGE.maps.impl.misc;
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@@ -10,16 +9,14 @@ import java.util.Objects;
|
|||||||
|
|
||||||
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
||||||
import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR;
|
import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR;
|
||||||
import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
|
import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
|
||||||
import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP;
|
import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP;
|
||||||
import speiger.src.collections.PACKAGE.maps.interfaces.SORTED_MAP;
|
|
||||||
import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET;
|
import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET;
|
||||||
import speiger.src.collections.PACKAGE.sets.SORTED_SET;
|
import speiger.src.collections.PACKAGE.sets.ORDERED_SET;
|
||||||
import speiger.src.collections.PACKAGE.sets.SET;
|
import speiger.src.collections.PACKAGE.sets.SET;
|
||||||
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION;
|
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION;
|
||||||
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION;
|
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION;
|
||||||
@@ -32,7 +29,6 @@ import speiger.src.collections.VALUE_PACKAGE.lists.VALUE_LIST_ITERATOR;
|
|||||||
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
|
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
|
||||||
import speiger.src.collections.objects.lists.ObjectListIterator;
|
import speiger.src.collections.objects.lists.ObjectListIterator;
|
||||||
import speiger.src.collections.objects.sets.AbstractObjectSet;
|
import speiger.src.collections.objects.sets.AbstractObjectSet;
|
||||||
import speiger.src.collections.objects.sets.ObjectSortedSet;
|
|
||||||
import speiger.src.collections.objects.sets.ObjectSet;
|
import speiger.src.collections.objects.sets.ObjectSet;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -43,7 +39,7 @@ import speiger.src.collections.objects.sets.ObjectSet;
|
|||||||
* @Type(T)
|
* @Type(T)
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
*/
|
*/
|
||||||
public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VALUE_GENERIC_TYPE implements SORTED_MAP KEY_VALUE_GENERIC_TYPE, ORDERED_MAP KEY_VALUE_GENERIC_TYPE
|
public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VALUE_GENERIC_TYPE implements ORDERED_MAP KEY_VALUE_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
/** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */
|
/** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */
|
||||||
protected long[] links;
|
protected long[] links;
|
||||||
@@ -270,20 +266,6 @@ public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VA
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(T fromKey, T toKey) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(T toKey) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(T fromKey) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T FIRST_ENTRY_KEY() {
|
public T FIRST_ENTRY_KEY() {
|
||||||
if(size == 0) throw new NoSuchElementException();
|
if(size == 0) throw new NoSuchElementException();
|
||||||
@@ -434,7 +416,7 @@ public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MapEntrySet extends AbstractObjectSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> implements SORTED_MAP.FastSortedSet KEY_VALUE_GENERIC_TYPE {
|
private class MapEntrySet extends AbstractObjectSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> implements ORDERED_MAP.FastOrderedSet KEY_VALUE_GENERIC_TYPE {
|
||||||
@Override
|
@Override
|
||||||
public boolean addAndMoveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); }
|
public boolean addAndMoveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
@@ -559,20 +541,9 @@ public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VA
|
|||||||
public void clear() {
|
public void clear() {
|
||||||
LINKED_ENUM_MAP.this.clear();
|
LINKED_ENUM_MAP.this.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Comparator<MAP.Entry KEY_VALUE_GENERIC_TYPE> comparator() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> subSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement, MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> headSet(MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> tailSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement) { throw new UnsupportedOperationException(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE {
|
private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE {
|
||||||
#if TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@@ -685,17 +656,6 @@ public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VA
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@Override
|
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE subSet(T fromElement, T toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE headSet(T toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE tailSet(T fromElement) { throw new UnsupportedOperationException(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Values extends VALUE_ABSTRACT_COLLECTION VALUE_GENERIC_TYPE {
|
private class Values extends VALUE_ABSTRACT_COLLECTION VALUE_GENERIC_TYPE {
|
||||||
|
|||||||
-33
@@ -363,19 +363,6 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@Override
|
|
||||||
public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public VALUE_TYPE getAndMoveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return comparator; }
|
public COMPARATOR KEY_GENERIC_TYPE comparator() { return comparator; }
|
||||||
|
|
||||||
@@ -1067,14 +1054,6 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
|
|||||||
#endif
|
#endif
|
||||||
@Override
|
@Override
|
||||||
public boolean add(KEY_TYPE e) { throw new UnsupportedOperationException(); }
|
public boolean add(KEY_TYPE e) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
|
||||||
public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement) {
|
public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement) {
|
||||||
@@ -1543,18 +1522,6 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
|
|||||||
protected Node KEY_VALUE_GENERIC_TYPE absHighFence() { return (toEnd ? null : (hiInclusive ? map.findHigherNode(hi) : map.findCeilingNode(hi))); }
|
protected Node KEY_VALUE_GENERIC_TYPE absHighFence() { return (toEnd ? null : (hiInclusive ? map.findHigherNode(hi) : map.findCeilingNode(hi))); }
|
||||||
protected Node KEY_VALUE_GENERIC_TYPE absLowFence() { return (fromStart ? null : (loInclusive ? map.findLowerNode(lo) : map.findFloorNode(lo))); }
|
protected Node KEY_VALUE_GENERIC_TYPE absLowFence() { return (fromStart ? null : (loInclusive ? map.findLowerNode(lo) : map.findFloorNode(lo))); }
|
||||||
|
|
||||||
@Override
|
|
||||||
public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public VALUE_TYPE getAndMoveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
@Override
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return map.comparator(); }
|
public COMPARATOR KEY_GENERIC_TYPE comparator() { return map.comparator(); }
|
||||||
|
|
||||||
|
|||||||
-34
@@ -366,19 +366,6 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@Override
|
|
||||||
public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public VALUE_TYPE getAndMoveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return comparator; }
|
public COMPARATOR KEY_GENERIC_TYPE comparator() { return comparator; }
|
||||||
|
|
||||||
@@ -1125,15 +1112,6 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
|
|||||||
#endif
|
#endif
|
||||||
@Override
|
@Override
|
||||||
public boolean add(KEY_TYPE e) { throw new UnsupportedOperationException(); }
|
public boolean add(KEY_TYPE e) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
|
||||||
public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement) {
|
public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement) {
|
||||||
if(map instanceof RB_TREE_MAP) return ((RB_TREE_MAP KEY_VALUE_GENERIC_TYPE)map).keyIterator(fromElement);
|
if(map instanceof RB_TREE_MAP) return ((RB_TREE_MAP KEY_VALUE_GENERIC_TYPE)map).keyIterator(fromElement);
|
||||||
@@ -1601,18 +1579,6 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
|
|||||||
protected Node KEY_VALUE_GENERIC_TYPE absHighFence() { return (toEnd ? null : (hiInclusive ? map.findHigherNode(hi) : map.findCeilingNode(hi))); }
|
protected Node KEY_VALUE_GENERIC_TYPE absHighFence() { return (toEnd ? null : (hiInclusive ? map.findHigherNode(hi) : map.findCeilingNode(hi))); }
|
||||||
protected Node KEY_VALUE_GENERIC_TYPE absLowFence() { return (fromStart ? null : (loInclusive ? map.findLowerNode(lo) : map.findFloorNode(lo))); }
|
protected Node KEY_VALUE_GENERIC_TYPE absLowFence() { return (fromStart ? null : (loInclusive ? map.findLowerNode(lo) : map.findFloorNode(lo))); }
|
||||||
|
|
||||||
@Override
|
|
||||||
public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public VALUE_TYPE getAndMoveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
@Override
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return map.comparator(); }
|
public COMPARATOR KEY_GENERIC_TYPE comparator() { return map.comparator(); }
|
||||||
|
|
||||||
|
|||||||
+95
@@ -0,0 +1,95 @@
|
|||||||
|
package speiger.src.collections.PACKAGE.maps.interfaces;
|
||||||
|
|
||||||
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.BiFunction;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A type specific ConcurrentMap interface that reduces boxing/unboxing.
|
||||||
|
* Since the interface adds nothing new. It is there just for completion sake.
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
*/
|
||||||
|
public interface CONCURRENT_MAP KEY_VALUE_GENERIC_TYPE extends ConcurrentMap<CLASS_TYPE, CLASS_VALUE_TYPE>, MAP KEY_VALUE_GENERIC_TYPE
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
@Primitive
|
||||||
|
public default CLASS_VALUE_TYPE compute(CLASS_TYPE key, BiFunction<? super CLASS_TYPE, ? super CLASS_VALUE_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
||||||
|
return MAP.super.compute(key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Primitive
|
||||||
|
public default CLASS_VALUE_TYPE computeIfAbsent(CLASS_TYPE key, Function<? super CLASS_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
||||||
|
return MAP.super.computeIfAbsent(key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Primitive
|
||||||
|
public default CLASS_VALUE_TYPE computeIfPresent(CLASS_TYPE key, BiFunction<? super CLASS_TYPE, ? super CLASS_VALUE_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
||||||
|
return MAP.super.computeIfPresent(key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Primitive
|
||||||
|
public default void forEach(BiConsumer<? super CLASS_TYPE, ? super CLASS_VALUE_TYPE> action) {
|
||||||
|
MAP.super.forEach(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Primitive
|
||||||
|
public default CLASS_VALUE_TYPE merge(CLASS_TYPE key, CLASS_VALUE_TYPE value, BiFunction<? super CLASS_VALUE_TYPE, ? super CLASS_VALUE_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
||||||
|
return MAP.super.merge(key, value, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if TYPE_OBJECT && VALUE_OBJECT
|
||||||
|
@Override
|
||||||
|
public CLASS_VALUE_TYPE getOrDefault(Object key, CLASS_VALUE_TYPE defaultValue);
|
||||||
|
@Override
|
||||||
|
public CLASS_VALUE_TYPE putIfAbsent(CLASS_TYPE key, CLASS_VALUE_TYPE value);
|
||||||
|
@Override
|
||||||
|
public boolean remove(Object key, Object value);
|
||||||
|
@Override
|
||||||
|
public boolean replace(CLASS_TYPE key, CLASS_VALUE_TYPE oldValue, CLASS_VALUE_TYPE newValue);
|
||||||
|
@Override
|
||||||
|
public CLASS_VALUE_TYPE replace(CLASS_TYPE key, CLASS_VALUE_TYPE value);
|
||||||
|
|
||||||
|
#else
|
||||||
|
@Primitive
|
||||||
|
@Override
|
||||||
|
public default CLASS_VALUE_TYPE getOrDefault(Object key, CLASS_VALUE_TYPE defaultValue) {
|
||||||
|
return MAP.super.getOrDefault(key, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Primitive
|
||||||
|
public default CLASS_VALUE_TYPE putIfAbsent(CLASS_TYPE key, CLASS_VALUE_TYPE value) {
|
||||||
|
return MAP.super.putIfAbsent(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public default boolean remove(Object key, Object value) {
|
||||||
|
return MAP.super.remove(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public default boolean replace(CLASS_TYPE key, CLASS_VALUE_TYPE oldValue, CLASS_VALUE_TYPE newValue) {
|
||||||
|
return MAP.super.replace(key, oldValue, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public default CLASS_VALUE_TYPE replace(CLASS_TYPE key, CLASS_VALUE_TYPE value) {
|
||||||
|
return MAP.super.replace(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public default void replaceAll(BiFunction<? super CLASS_TYPE, ? super CLASS_VALUE_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
||||||
|
MAP.super.replaceAll(mappingFunction);
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -31,6 +31,7 @@ import speiger.src.collections.PACKAGE.maps.impl.immutable.IMMUTABLE_HASH_MAP;
|
|||||||
import speiger.src.collections.PACKAGE.maps.impl.tree.AVL_TREE_MAP;
|
import speiger.src.collections.PACKAGE.maps.impl.tree.AVL_TREE_MAP;
|
||||||
import speiger.src.collections.PACKAGE.maps.impl.tree.RB_TREE_MAP;
|
import speiger.src.collections.PACKAGE.maps.impl.tree.RB_TREE_MAP;
|
||||||
import speiger.src.collections.PACKAGE.maps.impl.misc.ARRAY_MAP;
|
import speiger.src.collections.PACKAGE.maps.impl.misc.ARRAY_MAP;
|
||||||
|
import speiger.src.collections.PACKAGE.maps.impl.concurrent.CONCURRENT_HASH_MAP;
|
||||||
#if TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.maps.impl.misc.ENUM_MAP;
|
import speiger.src.collections.PACKAGE.maps.impl.misc.ENUM_MAP;
|
||||||
import speiger.src.collections.PACKAGE.maps.impl.misc.LINKED_ENUM_MAP;
|
import speiger.src.collections.PACKAGE.maps.impl.misc.LINKED_ENUM_MAP;
|
||||||
@@ -1508,6 +1509,14 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
|||||||
return putElements(new LINKED_CUSTOM_HASH_MAPKV_BRACES(size, strategy));
|
return putElements(new LINKED_CUSTOM_HASH_MAPKV_BRACES(size, strategy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the Keys and Values into a Concurrent Hash Map
|
||||||
|
* @return a CONCURRENT_HASH_MAP
|
||||||
|
*/
|
||||||
|
public CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE concurrentMap() {
|
||||||
|
return putElements(new CONCURRENT_HASH_MAPKV_BRACES(size));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the Keys and Values into a Array Map
|
* Builds the Keys and Values into a Array Map
|
||||||
* @return a ARRAY_MAP
|
* @return a ARRAY_MAP
|
||||||
|
|||||||
+21
@@ -1,6 +1,8 @@
|
|||||||
package speiger.src.collections.PACKAGE.maps.interfaces;
|
package speiger.src.collections.PACKAGE.maps.interfaces;
|
||||||
|
|
||||||
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
|
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
|
||||||
|
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
|
||||||
|
import speiger.src.collections.objects.sets.ObjectOrderedSet;
|
||||||
/**
|
/**
|
||||||
* A Special Map Interface giving Access to some really usefull functions
|
* A Special Map Interface giving Access to some really usefull functions
|
||||||
* The Idea behind this interface is to allow access to functions that give control to the Order of elements.
|
* The Idea behind this interface is to allow access to functions that give control to the Order of elements.
|
||||||
@@ -98,6 +100,7 @@ public interface ORDERED_MAP KEY_VALUE_GENERIC_TYPE extends MAP KEY_VALUE_GENERI
|
|||||||
* @return a new SortedMap that is synchronized
|
* @return a new SortedMap that is synchronized
|
||||||
* @see MAPS#synchronize
|
* @see MAPS#synchronize
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public default ORDERED_MAP KEY_VALUE_GENERIC_TYPE synchronize() { return MAPS.synchronize(this); }
|
public default ORDERED_MAP KEY_VALUE_GENERIC_TYPE synchronize() { return MAPS.synchronize(this); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,6 +109,7 @@ public interface ORDERED_MAP KEY_VALUE_GENERIC_TYPE extends MAP KEY_VALUE_GENERI
|
|||||||
* @return a new SortedMap Wrapper that is synchronized
|
* @return a new SortedMap Wrapper that is synchronized
|
||||||
* @see MAPS#synchronize
|
* @see MAPS#synchronize
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public default ORDERED_MAP KEY_VALUE_GENERIC_TYPE synchronize(Object mutex) { return MAPS.synchronize(this, mutex); }
|
public default ORDERED_MAP KEY_VALUE_GENERIC_TYPE synchronize(Object mutex) { return MAPS.synchronize(this, mutex); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -113,5 +117,22 @@ public interface ORDERED_MAP KEY_VALUE_GENERIC_TYPE extends MAP KEY_VALUE_GENERI
|
|||||||
* @return a new SortedMap Wrapper that is unmodifiable
|
* @return a new SortedMap Wrapper that is unmodifiable
|
||||||
* @see MAPS#unmodifiable
|
* @see MAPS#unmodifiable
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public default ORDERED_MAP KEY_VALUE_GENERIC_TYPE unmodifiable() { return MAPS.unmodifiable(this); }
|
public default ORDERED_MAP KEY_VALUE_GENERIC_TYPE unmodifiable() { return MAPS.unmodifiable(this); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fast Ordered Entry Set that allows for a faster Entry Iterator by recycling the Entry Object and just exchanging 1 internal value
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
*/
|
||||||
|
interface FastOrderedSet KEY_VALUE_GENERIC_TYPE extends MAP.FastEntrySet KEY_VALUE_GENERIC_TYPE, ObjectOrderedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> {
|
||||||
|
@Override
|
||||||
|
public ObjectBidirectionalIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> fastIterator();
|
||||||
|
/**
|
||||||
|
* Fast iterator that recycles the given Entry object to improve speed and reduce object allocation
|
||||||
|
* @param fromElement that is going to be started from.
|
||||||
|
* @return a improved iterator that starts from the desired element
|
||||||
|
*/
|
||||||
|
public ObjectBidirectionalIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> fastIterator(KEY_TYPE fromElement);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+6
-58
@@ -22,65 +22,8 @@ import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
|
|||||||
* @note ORDERED_MAP is only extended until 0.6.0 for Compat reasons.
|
* @note ORDERED_MAP is only extended until 0.6.0 for Compat reasons.
|
||||||
* The supported classes already implement ORDERED_MAP directly and will remove SORTED_MAP implementations in favor of ORDERED_MAP instead
|
* The supported classes already implement ORDERED_MAP directly and will remove SORTED_MAP implementations in favor of ORDERED_MAP instead
|
||||||
*/
|
*/
|
||||||
public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap<CLASS_TYPE, CLASS_VALUE_TYPE>, ORDERED_MAP KEY_VALUE_GENERIC_TYPE
|
public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap<CLASS_TYPE, CLASS_VALUE_TYPE>, MAP KEY_VALUE_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* A customized put method that allows you to insert into the first index.
|
|
||||||
* @param key the key that should be inserted
|
|
||||||
* @param value the value that should be inserted
|
|
||||||
* @return the previous present or default return value
|
|
||||||
* @see java.util.Map#put(Object, Object)
|
|
||||||
* @note some implementations do not support this method
|
|
||||||
* @deprecated use ORDERED_MAP#putAndMoveToFirst instead (removed in 0.6.0)
|
|
||||||
*/
|
|
||||||
public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value);
|
|
||||||
/**
|
|
||||||
* A customized put method that allows you to insert into the last index. (This may be nessesary depending on the implementation)
|
|
||||||
* @param key the key that should be inserted
|
|
||||||
* @param value the value that should be inserted
|
|
||||||
* @return the previous present or default return value
|
|
||||||
* @see java.util.Map#put(Object, Object)
|
|
||||||
* @note some implementations do not support this method
|
|
||||||
* @deprecated use ORDERED_MAP#putAndMoveToLast instead (removed in 0.6.0)
|
|
||||||
*/
|
|
||||||
public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A specific move method to move a given key/value to the first index.
|
|
||||||
* @param key that should be moved to the first index
|
|
||||||
* @return true if the value was moved.
|
|
||||||
* @note returns false if the value was not present in the first place
|
|
||||||
* @note some implementations do not support this method
|
|
||||||
* @deprecated use ORDERED_MAP#moveToFirst instead (removed in 0.6.0)
|
|
||||||
*/
|
|
||||||
public boolean moveToFirst(KEY_TYPE key);
|
|
||||||
/**
|
|
||||||
* A specific move method to move a given key/value to the last index.
|
|
||||||
* @param key that should be moved to the first last
|
|
||||||
* @return true if the value was moved.
|
|
||||||
* @note returns false if the value was not present in the first place
|
|
||||||
* @note some implementations do not support this method
|
|
||||||
* @deprecated use ORDERED_MAP#moveToLast instead (removed in 0.6.0)
|
|
||||||
*/
|
|
||||||
public boolean moveToLast(KEY_TYPE key);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Specific get method that allows to move teh given key/value int the first index.
|
|
||||||
* @param key that is searched for
|
|
||||||
* @return the given value for the requested key or default return value
|
|
||||||
* @note some implementations do not support this method
|
|
||||||
* @deprecated use ORDERED_MAP#getAndMoveToFirst instead (removed in 0.6.0)
|
|
||||||
*/
|
|
||||||
public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key);
|
|
||||||
/**
|
|
||||||
* A Specific get method that allows to move teh given key/value int the last index.
|
|
||||||
* @param key that is searched for
|
|
||||||
* @return the given value for the requested key or default return value
|
|
||||||
* @note some implementations do not support this method
|
|
||||||
* @deprecated use ORDERED_MAP#getAndMoveToLast instead (removed in 0.6.0)
|
|
||||||
*/
|
|
||||||
public VALUE_TYPE getAndMoveToLast(KEY_TYPE key);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator();
|
public COMPARATOR KEY_GENERIC_TYPE comparator();
|
||||||
|
|
||||||
@@ -227,6 +170,11 @@ public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap<CLASS_TYPE,
|
|||||||
interface FastSortedSet KEY_VALUE_GENERIC_TYPE extends MAP.FastEntrySet KEY_VALUE_GENERIC_TYPE, ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> {
|
interface FastSortedSet KEY_VALUE_GENERIC_TYPE extends MAP.FastEntrySet KEY_VALUE_GENERIC_TYPE, ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> {
|
||||||
@Override
|
@Override
|
||||||
public ObjectBidirectionalIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> fastIterator();
|
public ObjectBidirectionalIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> fastIterator();
|
||||||
|
/**
|
||||||
|
* Fast iterator that recycles the given Entry object to improve speed and reduce object allocation
|
||||||
|
* @param fromElement that is going to be started from.
|
||||||
|
* @return a improved iterator that starts from the desired element
|
||||||
|
*/
|
||||||
public ObjectBidirectionalIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> fastIterator(KEY_TYPE fromElement);
|
public ObjectBidirectionalIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> fastIterator(KEY_TYPE fromElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -295,18 +295,6 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@Override
|
|
||||||
public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean moveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean moveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE lower(KEY_TYPE e) {
|
public KEY_TYPE lower(KEY_TYPE e) {
|
||||||
Entry KEY_GENERIC_TYPE node = findLowerNode(e);
|
Entry KEY_GENERIC_TYPE node = findLowerNode(e);
|
||||||
@@ -1203,15 +1191,6 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
|
|||||||
return entry.key;
|
return entry.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubSet KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public SubSet KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package speiger.src.collections.PACKAGE.sets;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
#if TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
#endif
|
#endif
|
||||||
@@ -21,7 +20,6 @@ import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUME
|
|||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
|
import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
import speiger.src.collections.objects.utils.ObjectArrays;
|
import speiger.src.collections.objects.utils.ObjectArrays;
|
||||||
#endif
|
#endif
|
||||||
@@ -36,7 +34,7 @@ import speiger.src.collections.PACKAGE.utils.ARRAYS;
|
|||||||
* This implementation does not shrink the backing array
|
* This implementation does not shrink the backing array
|
||||||
* @Type(T)
|
* @Type(T)
|
||||||
*/
|
*/
|
||||||
public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE, ORDERED_SET KEY_GENERIC_TYPE
|
public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
/** The Backing Array */
|
/** The Backing Array */
|
||||||
protected transient KEY_TYPE[] data;
|
protected transient KEY_TYPE[] data;
|
||||||
@@ -510,31 +508,6 @@ public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE im
|
|||||||
throw new NoSuchElementException();
|
throw new NoSuchElementException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Unsupported for now. Implementation is buggy and does not support the Java Standard with these functions.
|
|
||||||
* It is a Unsorted Sorted Set. Thats why the SubSet implementation will be disabled until a better solution is found.
|
|
||||||
* To give a simple reason: LinkedHashSets are also not SortedSets even so they could be.
|
|
||||||
* @throws UnsupportedOperationException because it is not supported
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
/**
|
|
||||||
* Unsupported for now. Implementation is buggy and does not support the Java Standard with these functions.
|
|
||||||
* It is a Unsorted Sorted Set. Thats why the SubSet implementation will be disabled until a better solution is found.
|
|
||||||
* To give a simple reason: LinkedHashSets are also not SortedSets even so they could be.
|
|
||||||
* @throws UnsupportedOperationException because it is not supported
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
/**
|
|
||||||
* Unsupported for now. Implementation is buggy and does not support the Java Standard with these functions.
|
|
||||||
* It is a Unsorted Sorted Set. Thats why the SubSet implementation will be disabled until a better solution is found.
|
|
||||||
* To give a simple reason: LinkedHashSets are also not SortedSets even so they could be.
|
|
||||||
* @throws UnsupportedOperationException because it is not supported
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
public ARRAY_SET KEY_GENERIC_TYPE copy() {
|
public ARRAY_SET KEY_GENERIC_TYPE copy() {
|
||||||
ARRAY_SET KEY_GENERIC_TYPE set = new ARRAY_SETBRACES();
|
ARRAY_SET KEY_GENERIC_TYPE set = new ARRAY_SETBRACES();
|
||||||
set.data = Arrays.copyOf(data, data.length);
|
set.data = Arrays.copyOf(data, data.length);
|
||||||
@@ -542,11 +515,6 @@ public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE im
|
|||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|||||||
+1
-15
@@ -1,7 +1,6 @@
|
|||||||
package speiger.src.collections.PACKAGE.sets;
|
package speiger.src.collections.PACKAGE.sets;
|
||||||
|
|
||||||
#if TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
#endif
|
#endif
|
||||||
@@ -15,7 +14,6 @@ import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
|||||||
import speiger.src.collections.PACKAGE.collections.COLLECTION;
|
import speiger.src.collections.PACKAGE.collections.COLLECTION;
|
||||||
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
@@ -34,7 +32,7 @@ import speiger.src.collections.utils.SanityChecks;
|
|||||||
* Extra to that there is a couple quality of life functions provided
|
* Extra to that there is a couple quality of life functions provided
|
||||||
* @Type(T)
|
* @Type(T)
|
||||||
*/
|
*/
|
||||||
public class IMMUTABLE_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE
|
public class IMMUTABLE_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
/** The Backing keys array */
|
/** The Backing keys array */
|
||||||
protected transient KEY_TYPE[] keys;
|
protected transient KEY_TYPE[] keys;
|
||||||
@@ -459,18 +457,6 @@ public class IMMUTABLE_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERI
|
|||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear() { throw new UnsupportedOperationException(); }
|
public void clear() { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
|||||||
+1
-17
@@ -1,7 +1,6 @@
|
|||||||
package speiger.src.collections.PACKAGE.sets;
|
package speiger.src.collections.PACKAGE.sets;
|
||||||
|
|
||||||
#if TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
#endif
|
#endif
|
||||||
@@ -16,9 +15,6 @@ import speiger.src.collections.PACKAGE.collections.COLLECTION;
|
|||||||
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
||||||
#if !TYPE_OBJECT
|
|
||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
|
||||||
#endif
|
|
||||||
import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR;
|
import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR;
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.utils.ITERATORS;
|
import speiger.src.collections.PACKAGE.utils.ITERATORS;
|
||||||
@@ -37,7 +33,7 @@ import speiger.src.collections.utils.SanityChecks;
|
|||||||
* This implementation of SortedSet does not support SubSet of any kind. It implements the interface due to sortability and first/last access
|
* This implementation of SortedSet does not support SubSet of any kind. It implements the interface due to sortability and first/last access
|
||||||
* @Type(T)
|
* @Type(T)
|
||||||
*/
|
*/
|
||||||
public class LINKED_CUSTOM_HASH_SET KEY_GENERIC_TYPE extends CUSTOM_HASH_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE, ORDERED_SET KEY_GENERIC_TYPE
|
public class LINKED_CUSTOM_HASH_SET KEY_GENERIC_TYPE extends CUSTOM_HASH_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
/** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */
|
/** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */
|
||||||
protected transient long[] links;
|
protected transient long[] links;
|
||||||
@@ -672,18 +668,6 @@ public class LINKED_CUSTOM_HASH_SET KEY_GENERIC_TYPE extends CUSTOM_HASH_SET KEY
|
|||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
private class SetIterator implements LIST_ITERATOR KEY_GENERIC_TYPE {
|
private class SetIterator implements LIST_ITERATOR KEY_GENERIC_TYPE {
|
||||||
int previous = -1;
|
int previous = -1;
|
||||||
int next = -1;
|
int next = -1;
|
||||||
|
|||||||
+1
-17
@@ -1,8 +1,5 @@
|
|||||||
package speiger.src.collections.PACKAGE.sets;
|
package speiger.src.collections.PACKAGE.sets;
|
||||||
|
|
||||||
#if TYPE_OBJECT
|
|
||||||
import java.util.Comparator;
|
|
||||||
#endif
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@@ -19,7 +16,6 @@ import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
|||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
@@ -38,7 +34,7 @@ import speiger.src.collections.utils.SanityChecks;
|
|||||||
* This implementation of SortedSet does not support SubSet of any kind. It implements the interface due to sortability and first/last access
|
* This implementation of SortedSet does not support SubSet of any kind. It implements the interface due to sortability and first/last access
|
||||||
* @Type(T)
|
* @Type(T)
|
||||||
*/
|
*/
|
||||||
public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE, ORDERED_SET KEY_GENERIC_TYPE
|
public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
/** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */
|
/** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */
|
||||||
protected transient long[] links;
|
protected transient long[] links;
|
||||||
@@ -643,18 +639,6 @@ public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE
|
|||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
private class SetIterator implements LIST_ITERATOR KEY_GENERIC_TYPE {
|
private class SetIterator implements LIST_ITERATOR KEY_GENERIC_TYPE {
|
||||||
int previous = -1;
|
int previous = -1;
|
||||||
int next = -1;
|
int next = -1;
|
||||||
|
|||||||
@@ -295,18 +295,6 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@Override
|
|
||||||
public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean moveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean moveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE lower(KEY_TYPE e) {
|
public KEY_TYPE lower(KEY_TYPE e) {
|
||||||
Entry KEY_GENERIC_TYPE node = findLowerNode(e);
|
Entry KEY_GENERIC_TYPE node = findLowerNode(e);
|
||||||
@@ -1264,15 +1252,6 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
|
|||||||
return entry.key;
|
return entry.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean moveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SubSet KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public SubSet KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
|||||||
@@ -19,47 +19,8 @@ import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
|
|||||||
* @note ORDERED_SET is only extended until 0.6.0 for Compat reasons.
|
* @note ORDERED_SET is only extended until 0.6.0 for Compat reasons.
|
||||||
* The supported classes already implement ORDERED_SET directly and will remove SORTED_SET implementations in favor of ORDERED_SET instead
|
* The supported classes already implement ORDERED_SET directly and will remove SORTED_SET implementations in favor of ORDERED_SET instead
|
||||||
*/
|
*/
|
||||||
public interface SORTED_SET KEY_GENERIC_TYPE extends ORDERED_SET KEY_GENERIC_TYPE, SortedSet<CLASS_TYPE>
|
public interface SORTED_SET KEY_GENERIC_TYPE extends SET KEY_GENERIC_TYPE, SortedSet<CLASS_TYPE>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* A customized add method that allows you to insert into the first index.
|
|
||||||
* @param o the element that should be inserted
|
|
||||||
* @return true if it was added
|
|
||||||
* @see java.util.Set#add(Object)
|
|
||||||
* @note some implementations do not support this method
|
|
||||||
* @deprecated use ORDERED_SET#addAndMoveToFirst instead (removed in 0.6.0)
|
|
||||||
*/
|
|
||||||
public boolean addAndMoveToFirst(KEY_TYPE o);
|
|
||||||
/**
|
|
||||||
* A customized add method that allows you to insert into the last index.
|
|
||||||
* @param o the element that should be inserted
|
|
||||||
* @return true if it was added
|
|
||||||
* @see java.util.Set#add(Object)
|
|
||||||
* @note some implementations do not support this method
|
|
||||||
* @deprecated use ORDERED_SET#addAndMoveToLast instead (removed in 0.6.0)
|
|
||||||
*/
|
|
||||||
public boolean addAndMoveToLast(KEY_TYPE o);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A specific move method to move a given key to the first index.
|
|
||||||
* @param o that should be moved to the first index
|
|
||||||
* @return true if the value was moved.
|
|
||||||
* @note returns false if the value was not present in the first place
|
|
||||||
* @note some implementations do not support this method
|
|
||||||
* @deprecated use ORDERED_SET#moveToFirst instead (removed in 0.6.0)
|
|
||||||
*/
|
|
||||||
public boolean moveToFirst(KEY_TYPE o);
|
|
||||||
/**
|
|
||||||
* A specific move method to move a given key to the last index.
|
|
||||||
* @param o that should be moved to the first last
|
|
||||||
* @return true if the value was moved.
|
|
||||||
* @note returns false if the value was not present in the first place
|
|
||||||
* @note some implementations do not support this method
|
|
||||||
* @deprecated use ORDERED_SET#moveToLast instead (removed in 0.6.0)
|
|
||||||
*/
|
|
||||||
public boolean moveToLast(KEY_TYPE o);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific Comparator method
|
* A Type Specific Comparator method
|
||||||
* @return the type specific comparator
|
* @return the type specific comparator
|
||||||
|
|||||||
+20
-11
@@ -8,9 +8,6 @@ import java.util.concurrent.TimeoutException;
|
|||||||
import java.util.concurrent.locks.LockSupport;
|
import java.util.concurrent.locks.LockSupport;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
|
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
@@ -71,15 +68,15 @@ import speiger.src.collections.utils.SanityChecks;
|
|||||||
* The Task Object is also pause-able/Interruptable at any moment during the Processing. <br>
|
* The Task Object is also pause-able/Interruptable at any moment during the Processing. <br>
|
||||||
*
|
*
|
||||||
* A small example
|
* A small example
|
||||||
* <pre>
|
* <pre><code>
|
||||||
* public void processFiles(ObjectCollection<String> potentialFiles) {
|
* public void processFiles(ObjectCollection<String> potentialFiles) {
|
||||||
* potentialFiles.asAsync()
|
* potentialFiles.asAsync()
|
||||||
* .map(Paths::get).filter(Files::exists) //Modifies the collection (Optional)
|
* .map(Paths::get).filter(Files::exists) //Modifies the collection (Optional)
|
||||||
* .forEach(Files::delete) //Creates the action (Required)
|
* .forEach(Files::delete) //Creates the action (Required)
|
||||||
* .callback(T -> {}} //Callback on completion (Optional)
|
* .onCompletion(T -> {}} //Callback on completion (Optional)
|
||||||
* .execute() //Starts the task. (Required)
|
* .execute() //Starts the task. (Required)
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </code></pre>
|
||||||
* @author Speiger
|
* @author Speiger
|
||||||
*
|
*
|
||||||
* @Type(T)
|
* @Type(T)
|
||||||
@@ -91,7 +88,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Main Constructor that uses a Iterable to build a Offthread Task.
|
* Main Constructor that uses a Iterable to build a Offthread Task.
|
||||||
* @param iterable
|
* @param iterable that should be processed
|
||||||
*/
|
*/
|
||||||
public ASYNC_BUILDER(ITERABLE KEY_GENERIC_TYPE iterable) {
|
public ASYNC_BUILDER(ITERABLE KEY_GENERIC_TYPE iterable) {
|
||||||
this.iterable = iterable;
|
this.iterable = iterable;
|
||||||
@@ -99,12 +96,22 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper constructor.
|
* Helper constructor.
|
||||||
* @param task
|
* @param task that had been build
|
||||||
*/
|
*/
|
||||||
public ASYNC_BUILDER(BASE_TASK KEY_GENERIC_TYPE task) {
|
public ASYNC_BUILDER(BASE_TASK KEY_GENERIC_TYPE task) {
|
||||||
this.task = task;
|
this.task = task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function that automatically wraps a Iterable into a AsyncBuilder since it forces this collections Iterable.
|
||||||
|
* @param iterable that should be wrapped
|
||||||
|
* @Type(T)
|
||||||
|
* @return a AsyncBuilder with the iterable wrapped
|
||||||
|
*/
|
||||||
|
public static GENERIC_KEY_BRACES ASYNC_BUILDER KEY_GENERIC_TYPE of(Iterable<CLASS_TYPE> iterable) {
|
||||||
|
return new ASYNC_BUILDERBRACES(ITERABLES.wrap(iterable));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps the elements to something else
|
* Maps the elements to something else
|
||||||
* @param mapper the mapping function
|
* @param mapper the mapping function
|
||||||
@@ -298,8 +305,9 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE
|
|||||||
* Can only be set after the action was decided on.
|
* Can only be set after the action was decided on.
|
||||||
* @param executor that executes the task, defaults to {@link SanityChecks#invokeAsyncTask(Runnable) }
|
* @param executor that executes the task, defaults to {@link SanityChecks#invokeAsyncTask(Runnable) }
|
||||||
* @return self with the executor set
|
* @return self with the executor set
|
||||||
|
* @note has to be NonNull
|
||||||
*/
|
*/
|
||||||
public ASYNC_BUILDER KEY_GENERIC_TYPE executor(@Nonnull Executor executor) {
|
public ASYNC_BUILDER KEY_GENERIC_TYPE executor(Executor executor) {
|
||||||
if(task == null) throw new IllegalStateException("Action is missing");
|
if(task == null) throw new IllegalStateException("Action is missing");
|
||||||
task.withExecutor(executor);
|
task.withExecutor(executor);
|
||||||
return this;
|
return this;
|
||||||
@@ -310,8 +318,9 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE
|
|||||||
* The state of the task has to be validated by the callback.
|
* The state of the task has to be validated by the callback.
|
||||||
* @param callback that should be notified after completion of the task
|
* @param callback that should be notified after completion of the task
|
||||||
* @return self with the callback set
|
* @return self with the callback set
|
||||||
|
* @note can be null
|
||||||
*/
|
*/
|
||||||
public ASYNC_BUILDER KEY_GENERIC_TYPE callback(@Nullable Consumer<TASK KEY_GENERIC_TYPE> callback) {
|
public ASYNC_BUILDER KEY_GENERIC_TYPE onCompletion(Consumer<TASK KEY_GENERIC_TYPE> callback) {
|
||||||
if(task == null) throw new IllegalStateException("Action is missing");
|
if(task == null) throw new IllegalStateException("Action is missing");
|
||||||
task.withCallback(callback);
|
task.withCallback(callback);
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -360,18 +360,6 @@ public class SETS
|
|||||||
s = c;
|
s = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public boolean moveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public boolean moveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
@Override
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return s.comparator(); }
|
public COMPARATOR KEY_GENERIC_TYPE comparator() { return s.comparator(); }
|
||||||
@Override
|
@Override
|
||||||
@@ -557,18 +545,6 @@ public class SETS
|
|||||||
s = c;
|
s = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public boolean addAndMoveToFirst(KEY_TYPE o) { synchronized(mutex) { return s.addAndMoveToFirst(o); } }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public boolean addAndMoveToLast(KEY_TYPE o) { synchronized(mutex) { return s.addAndMoveToLast(o); } }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public boolean moveToFirst(KEY_TYPE o) { synchronized(mutex) { return s.moveToFirst(o); } }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public boolean moveToLast(KEY_TYPE o) { synchronized(mutex) { return s.moveToLast(o); } }
|
|
||||||
@Override
|
@Override
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator(){ synchronized(mutex) { return s.comparator(); } }
|
public COMPARATOR KEY_GENERIC_TYPE comparator(){ synchronized(mutex) { return s.comparator(); } }
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -517,24 +517,6 @@ public class MAPS
|
|||||||
this.map = map;
|
this.map = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public boolean moveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public boolean moveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public VALUE_TYPE getAndMoveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
@Override
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return map.comparator(); }
|
public COMPARATOR KEY_GENERIC_TYPE comparator() { return map.comparator(); }
|
||||||
@Override
|
@Override
|
||||||
@@ -833,24 +815,6 @@ public class MAPS
|
|||||||
this.map = map;
|
this.map = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value) { synchronized(mutex) { return map.putAndMoveToFirst(key, value); } }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value) { synchronized(mutex) { return map.putAndMoveToLast(key, value); } }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public boolean moveToFirst(KEY_TYPE key) { synchronized(mutex) { return map.moveToFirst(key); } }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public boolean moveToLast(KEY_TYPE key) { synchronized(mutex) { return map.moveToLast(key); } }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key) { synchronized(mutex) { return map.getAndMoveToFirst(key); } }
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public VALUE_TYPE getAndMoveToLast(KEY_TYPE key) { synchronized(mutex) { return map.getAndMoveToLast(key); } }
|
|
||||||
@Override
|
@Override
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { synchronized(mutex) { return map.comparator(); } }
|
public COMPARATOR KEY_GENERIC_TYPE comparator() { synchronized(mutex) { return map.comparator(); } }
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ public class HashUtil
|
|||||||
{
|
{
|
||||||
/** Minimum HashMap Capacity */
|
/** Minimum HashMap Capacity */
|
||||||
public static final int DEFAULT_MIN_CAPACITY = 16;
|
public static final int DEFAULT_MIN_CAPACITY = 16;
|
||||||
|
/** Minimum ConcurrentHashMap Concurrency */
|
||||||
|
public static final int DEFAULT_MIN_CONCURRENCY = 4;
|
||||||
/** Default HashMap Load Factor */
|
/** Default HashMap Load Factor */
|
||||||
public static final float DEFAULT_LOAD_FACTOR = 0.75F;
|
public static final float DEFAULT_LOAD_FACTOR = 0.75F;
|
||||||
/** HashMap Load Factor with reduced hash collisions but more memory usage */
|
/** HashMap Load Factor with reduced hash collisions but more memory usage */
|
||||||
|
|||||||
@@ -123,8 +123,8 @@ public abstract class BaseIntIterableTest
|
|||||||
@Test
|
@Test
|
||||||
public void testStreamMap() {
|
public void testStreamMap() {
|
||||||
if(getValidIterableTests().contains(IterableTest.STREAM_MAP)) {
|
if(getValidIterableTests().contains(IterableTest.STREAM_MAP)) {
|
||||||
Integer[] expected = IntStream.of(TEST_ARRAY).mapToObj(Integer::new).toArray(Integer[]::new);
|
Integer[] expected = IntStream.of(TEST_ARRAY).mapToObj(Integer::valueOf).toArray(Integer[]::new);
|
||||||
Integer[] actual = ObjectIterators.pour(create(TEST_ARRAY).map(Integer::new).iterator()).toArray(Integer[]::new);
|
Integer[] actual = ObjectIterators.pour(create(TEST_ARRAY).map(Integer::valueOf).iterator()).toArray(Integer[]::new);
|
||||||
ObjectArrays.stableSort(actual);
|
ObjectArrays.stableSort(actual);
|
||||||
Assert.assertArrayEquals(expected, actual);
|
Assert.assertArrayEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package speiger.src.collections.objects.list;
|
package speiger.src.collections.objects.list;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@@ -8,14 +11,18 @@ import com.google.common.collect.testing.TestStringListGenerator;
|
|||||||
import com.google.common.collect.testing.features.CollectionFeature;
|
import com.google.common.collect.testing.features.CollectionFeature;
|
||||||
import com.google.common.collect.testing.features.CollectionSize;
|
import com.google.common.collect.testing.features.CollectionSize;
|
||||||
import com.google.common.collect.testing.features.ListFeature;
|
import com.google.common.collect.testing.features.ListFeature;
|
||||||
|
import com.google.common.collect.testing.testers.ListListIteratorTester;
|
||||||
|
import com.google.common.collect.testing.testers.ListSubListTester;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
import speiger.src.collections.ints.lists.CopyOnWriteIntArrayList;
|
||||||
import speiger.src.collections.ints.lists.ImmutableIntList;
|
import speiger.src.collections.ints.lists.ImmutableIntList;
|
||||||
import speiger.src.collections.ints.lists.IntArrayList;
|
import speiger.src.collections.ints.lists.IntArrayList;
|
||||||
import speiger.src.collections.ints.lists.IntLinkedList;
|
import speiger.src.collections.ints.lists.IntLinkedList;
|
||||||
import speiger.src.collections.ints.lists.IntList;
|
import speiger.src.collections.ints.lists.IntList;
|
||||||
|
import speiger.src.collections.objects.lists.CopyOnWriteObjectArrayList;
|
||||||
import speiger.src.collections.objects.lists.ImmutableObjectList;
|
import speiger.src.collections.objects.lists.ImmutableObjectList;
|
||||||
import speiger.src.collections.objects.lists.ObjectArrayList;
|
import speiger.src.collections.objects.lists.ObjectArrayList;
|
||||||
import speiger.src.collections.objects.lists.ObjectLinkedList;
|
import speiger.src.collections.objects.lists.ObjectLinkedList;
|
||||||
@@ -28,9 +35,11 @@ public class ObjectListTests extends TestCase
|
|||||||
TestSuite suite = new TestSuite("Lists");
|
TestSuite suite = new TestSuite("Lists");
|
||||||
suite.addTest(suite("ArrayList", T -> new ObjectArrayList<>(T)));
|
suite.addTest(suite("ArrayList", T -> new ObjectArrayList<>(T)));
|
||||||
suite.addTest(suite("LinkedList", T -> new ObjectLinkedList<>(T)));
|
suite.addTest(suite("LinkedList", T -> new ObjectLinkedList<>(T)));
|
||||||
|
suite.addTest(copyOnWriteSuite("CopyOnWriteArrayList", T -> new CopyOnWriteObjectArrayList<>(T)));
|
||||||
suite.addTest(immutableSuite("ImmutableList", T -> new ImmutableObjectList<>(T)));
|
suite.addTest(immutableSuite("ImmutableList", T -> new ImmutableObjectList<>(T)));
|
||||||
suite.addTest(intSuite("IntArrayList", IntArrayList::new));
|
suite.addTest(intSuite("IntArrayList", IntArrayList::new));
|
||||||
suite.addTest(intSuite("IntLinkedList", IntLinkedList::new));
|
suite.addTest(intSuite("IntLinkedList", IntLinkedList::new));
|
||||||
|
suite.addTest(intCopyOnWriteSuite("CopyOnWriteArrayList", CopyOnWriteIntArrayList::new));
|
||||||
suite.addTest(intImmutableSuite("IntImmutableList", ImmutableIntList::new));
|
suite.addTest(intImmutableSuite("IntImmutableList", ImmutableIntList::new));
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
@@ -39,6 +48,10 @@ public class ObjectListTests extends TestCase
|
|||||||
return ListTestSuiteBuilder.using(new TestIntListGenerator(factory)).named(name).withFeatures(ListFeature.GENERAL_PURPOSE, CollectionSize.ANY).createTestSuite();
|
return ListTestSuiteBuilder.using(new TestIntListGenerator(factory)).named(name).withFeatures(ListFeature.GENERAL_PURPOSE, CollectionSize.ANY).createTestSuite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Test intCopyOnWriteSuite(String name, Function<int[], IntList> factory) {
|
||||||
|
return ListTestSuiteBuilder.using(new TestIntListGenerator(factory)).named(name).suppressing(suppressForCopyOnWriteArrayList()).withFeatures(ListFeature.SUPPORTS_SET, ListFeature.SUPPORTS_ADD_WITH_INDEX, ListFeature.SUPPORTS_REMOVE_WITH_INDEX, CollectionFeature.SUPPORTS_ADD, CollectionFeature.SUPPORTS_REMOVE, CollectionSize.ANY).createTestSuite();
|
||||||
|
}
|
||||||
|
|
||||||
public static Test intImmutableSuite(String name, Function<int[], IntList> factory) {
|
public static Test intImmutableSuite(String name, Function<int[], IntList> factory) {
|
||||||
return ListTestSuiteBuilder.using(new TestIntListGenerator(factory)).named(name).withFeatures(CollectionSize.ANY).createTestSuite();
|
return ListTestSuiteBuilder.using(new TestIntListGenerator(factory)).named(name).withFeatures(CollectionSize.ANY).createTestSuite();
|
||||||
}
|
}
|
||||||
@@ -50,10 +63,21 @@ public class ObjectListTests extends TestCase
|
|||||||
}).named(name).withFeatures(ListFeature.GENERAL_PURPOSE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionSize.ANY).createTestSuite();
|
}).named(name).withFeatures(ListFeature.GENERAL_PURPOSE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionSize.ANY).createTestSuite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Test copyOnWriteSuite(String name, Function<String[], List<String>> factory) {
|
||||||
|
return ListTestSuiteBuilder.using(new TestStringListGenerator() {
|
||||||
|
@Override
|
||||||
|
protected List<String> create(String[] elements) { return factory.apply(elements); }
|
||||||
|
}).named(name).suppressing(suppressForCopyOnWriteArrayList()).withFeatures(ListFeature.SUPPORTS_SET, ListFeature.SUPPORTS_ADD_WITH_INDEX, ListFeature.SUPPORTS_REMOVE_WITH_INDEX, CollectionFeature.SUPPORTS_ADD, CollectionFeature.SUPPORTS_REMOVE, CollectionFeature.ALLOWS_NULL_VALUES, CollectionSize.ANY).createTestSuite();
|
||||||
|
}
|
||||||
|
|
||||||
public static Test immutableSuite(String name, Function<String[], List<String>> factory) {
|
public static Test immutableSuite(String name, Function<String[], List<String>> factory) {
|
||||||
return ListTestSuiteBuilder.using(new TestStringListGenerator() {
|
return ListTestSuiteBuilder.using(new TestStringListGenerator() {
|
||||||
@Override
|
@Override
|
||||||
protected List<String> create(String[] elements) { return factory.apply(elements); }
|
protected List<String> create(String[] elements) { return factory.apply(elements); }
|
||||||
}).named(name).withFeatures(CollectionFeature.ALLOWS_NULL_VALUES, CollectionSize.ANY).createTestSuite();
|
}).named(name).withFeatures(CollectionFeature.ALLOWS_NULL_VALUES, CollectionSize.ANY).createTestSuite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Collection<Method> suppressForCopyOnWriteArrayList() {
|
||||||
|
return Arrays.asList(ListSubListTester.getSubListSubListRemoveAffectsOriginalLargeListMethod(), ListListIteratorTester.getListIteratorFullyModifiableMethod());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.google.common.collect.testing.features.MapFeature;
|
|||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
import speiger.src.collections.objects.maps.impl.concurrent.Object2ObjectConcurrentOpenHashMap;
|
||||||
import speiger.src.collections.objects.maps.impl.customHash.Object2ObjectLinkedOpenCustomHashMap;
|
import speiger.src.collections.objects.maps.impl.customHash.Object2ObjectLinkedOpenCustomHashMap;
|
||||||
import speiger.src.collections.objects.maps.impl.customHash.Object2ObjectOpenCustomHashMap;
|
import speiger.src.collections.objects.maps.impl.customHash.Object2ObjectOpenCustomHashMap;
|
||||||
import speiger.src.collections.objects.maps.impl.hash.Object2ObjectLinkedOpenHashMap;
|
import speiger.src.collections.objects.maps.impl.hash.Object2ObjectLinkedOpenHashMap;
|
||||||
@@ -42,6 +43,7 @@ public class ObjectMapTests extends TestCase
|
|||||||
suite.addTest(suite("LinkedHashMap", Object2ObjectLinkedOpenHashMap::new, true));
|
suite.addTest(suite("LinkedHashMap", Object2ObjectLinkedOpenHashMap::new, true));
|
||||||
suite.addTest(suite("CustomHashMap", () -> new Object2ObjectOpenCustomHashMap<>(Strategy.INSTANCE), true));
|
suite.addTest(suite("CustomHashMap", () -> new Object2ObjectOpenCustomHashMap<>(Strategy.INSTANCE), true));
|
||||||
suite.addTest(suite("LinkedCustomHashMap", () -> new Object2ObjectLinkedOpenCustomHashMap<>(Strategy.INSTANCE), true));
|
suite.addTest(suite("LinkedCustomHashMap", () -> new Object2ObjectLinkedOpenCustomHashMap<>(Strategy.INSTANCE), true));
|
||||||
|
suite.addTest(suite("ConcurrentHashMap", Object2ObjectConcurrentOpenHashMap::new, true));
|
||||||
suite.addTest(navigableSuite("RBTreeMap_NonNull", Object2ObjectRBTreeMap::new, false));
|
suite.addTest(navigableSuite("RBTreeMap_NonNull", Object2ObjectRBTreeMap::new, false));
|
||||||
suite.addTest(navigableSuite("AVLTreeMap_NonNull", Object2ObjectAVLTreeMap::new, false));
|
suite.addTest(navigableSuite("AVLTreeMap_NonNull", Object2ObjectAVLTreeMap::new, false));
|
||||||
suite.addTest(navigableSuite("RBTreeMap_Null", () -> new Object2ObjectRBTreeMap<>(new NullFriendlyComparator()), true));
|
suite.addTest(navigableSuite("RBTreeMap_Null", () -> new Object2ObjectRBTreeMap<>(new NullFriendlyComparator()), true));
|
||||||
|
|||||||
Reference in New Issue
Block a user