Loads of new features & fixes.

- Added: pour function directly into Iterable which allows to collect
all elements in the Iterable directly.
- Added: The new ToArray method from Java9 and newer into the library.
Using a functional interface. (Just a backport)
- Changed: Reworked how the Map Builder functions are created. They are
now in a SubClass that moves them out of the way. Less Clutter. (This
might break things if that was used before)
- Added: Map Builder that allows now to Build Maps like Guava
ImmutableMaps can be build. Note: This has a slight performance
overhead.
- Added: Unmodifiable and Synchronize wrapper functions direclty into
Collection Interfaces. This is mostly a quality of life thing.
- Added: Unmodifiable and Synchronized Wrapper Collections can now be
cloned. They clone the underlying map which doesn't break functionality.
(Had a usecase for it)
- Added: A boxed putAll array variant.
- Fixed: EnumMaps didn't keep track of their size and now got proper
care and implementations as needed. There might be more work required
but at least the core functionality is now up to date.
This commit is contained in:
2021-12-09 09:14:55 +01:00
parent a2506b927a
commit c4964806f0
25 changed files with 1752 additions and 601 deletions
@@ -4,6 +4,7 @@ import java.util.NavigableSet;
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
import speiger.src.collections.PACKAGE.utils.SETS;
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
/**
@@ -118,6 +119,30 @@ public interface NAVIGABLE_SET KEY_GENERIC_TYPE extends NavigableSet<CLASS_TYPE>
@Override
public NAVIGABLE_SET KEY_GENERIC_TYPE copy();
#if !TYPE_BOOLEAN
/**
* Creates a Wrapped NavigableSet that is Synchronized
* @return a new NavigableSet that is synchronized
* @see SETS#synchronize
*/
public default NAVIGABLE_SET KEY_GENERIC_TYPE synchronize() { return SETS.synchronize(this); }
/**
* Creates a Wrapped NavigableSet that is Synchronized
* @param mutex is the controller of the synchronization block
* @return a new NavigableSet Wrapper that is synchronized
* @see SETS#synchronize
*/
public default NAVIGABLE_SET KEY_GENERIC_TYPE synchronize(Object mutex) { return SETS.synchronize(this, mutex); }
/**
* Creates a Wrapped NavigableSet that is unmodifiable
* @return a new NavigableSet Wrapper that is unmodifiable
* @see SETS#unmodifiable
*/
public default NAVIGABLE_SET KEY_GENERIC_TYPE unmodifiable() { return SETS.unmodifiable(this); }
#endif
/**
* A Type Specific Type Splititerator to reduce boxing/unboxing
* @return type specific splititerator
@@ -5,8 +5,12 @@ import java.util.Set;
import speiger.src.collections.PACKAGE.collections.COLLECTION;
import speiger.src.collections.PACKAGE.collections.ITERATOR;
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
#if !TYPE_BOOLEAN
import speiger.src.collections.PACKAGE.utils.SETS;
#endif
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
/**
* A Type Specific Set class to reduce boxing/unboxing
* @Type(T)
@@ -49,6 +53,31 @@ public interface SET KEY_GENERIC_TYPE extends Set<CLASS_TYPE>, COLLECTION KEY_GE
public default boolean remove(Object o) {
return COLLECTION.super.remove(o);
}
#endif
#if !TYPE_BOOLEAN
/**
* Creates a Wrapped Set that is Synchronized
* @return a new Set that is synchronized
* @see SETS#synchronize
*/
public default SET KEY_GENERIC_TYPE synchronize() { return SETS.synchronize(this); }
/**
* Creates a Wrapped Set that is Synchronized
* @param mutex is the controller of the synchronization block
* @return a new Set Wrapper that is synchronized
* @see SETS#synchronize
*/
public default SET KEY_GENERIC_TYPE synchronize(Object mutex) { return SETS.synchronize(this, mutex); }
/**
* Creates a Wrapped Set that is unmodifiable
* @return a new Set Wrapper that is unmodifiable
* @see SETS#unmodifiable
*/
public default SET KEY_GENERIC_TYPE unmodifiable() { return SETS.unmodifiable(this); }
#endif
/**
* A Type Specific Type Splititerator to reduce boxing/unboxing
@@ -9,6 +9,7 @@ import java.util.Comparator;
#else
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
#endif
import speiger.src.collections.PACKAGE.utils.SETS;
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
/**
@@ -73,6 +74,30 @@ public interface SORTED_SET KEY_GENERIC_TYPE extends SET KEY_GENERIC_TYPE, Sorte
*/
public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement);
#if !TYPE_BOOLEAN
/**
* Creates a Wrapped SortedSet that is Synchronized
* @return a new SortedSet that is synchronized
* @see SETS#synchronize
*/
public default SORTED_SET KEY_GENERIC_TYPE synchronize() { return SETS.synchronize(this); }
/**
* Creates a Wrapped SortedSet that is Synchronized
* @param mutex is the controller of the synchronization block
* @return a new SortedSet Wrapper that is synchronized
* @see SETS#synchronize
*/
public default SORTED_SET KEY_GENERIC_TYPE synchronize(Object mutex) { return SETS.synchronize(this, mutex); }
/**
* Creates a Wrapped SortedSet that is unmodifiable
* @return a new SortedSet Wrapper that is unmodifiable
* @see SETS#unmodifiable
*/
public default SORTED_SET KEY_GENERIC_TYPE unmodifiable() { return SETS.unmodifiable(this); }
#endif
/**
* A Type Specific Type Splititerator to reduce boxing/unboxing
* @return type specific splititerator