Skip to content

JS / TS 2.0.x

Latest

Choose a tag to compare

@joooKiwi joooKiwi released this 01 Apr 17:02
· 5 commits to develop since this release

New collections that were drafted from the upcoming Java implementation.

Changes in the CollectionHolder instances

A lot of new instances have been created ranging from adaptor classes, encapsulator classes to conversion from the beta CollectionHandler (with its deprecation change).
More size related methods are being added to give more options toward the iterators and collections.
Little addition on the exception being thrown for an index IndexNotFoundException instead of IndexOutOfBoundsException
And note that the lazy instances are being repurpose for an encapsulator class to create a specialized class under its hood.

  • New alias method hasAtLeast1Element, containsAtLeast1Element & includesAtLeast1Element for isNotEmpty
  • New method hasExactly1Element with alias containsExactly1Element & includesExactly1Element
  • New method hasAtMost1Element with alias containsAtMost1Element & includesAtMost1Element
  • New method hasAtLeast2Elements with alias containsAtLeast2Elements & includesAtLeast2Elements
  • New method hasExactly2Elements with alias containsExactly2Elements & includesExactly2Elements
  • New method hasAtMost2Elements with alias containsAtMost2Elements & includesAtMost2Elements
  • Change of exception being thrown for firstIndexOf, lastIndexOf, indexOfFirst, indexOfFirstIndexed, indexOfLast, indexOfLastIndexed to have EmptyCollectionException, IndexNotFoundException, IndexOutOfBoundsException, ForbiddenIndexException & InvalidIndexRangeException as the possible exception being thrown
  • New AbstractUnimplementedCollectionHolder (for collections with specified non-aliased methods)
  • New AbstractCollectionHolderOf1 (for collections with only a single value)
  • New AbstractCollectionHolderOf2 (for collections with only two values)
  • New MinimalistAsCollectionHolder (an adaptor class for the MinimalistCollectionHolder)
  • New CollectionViewer (to encapsulate a CollectionHolder)
  • New MinimalistCollectionViewer (to encapsulate a MinimalistCollectionHolder)
  • New CollectionHolderOf1 (to get a CollectionHolder of 1 value)
  • New CollectionHolderOf2 (to get a CollectionHolder of 2 values)
  • New ArrayAsCollectionHolder (an adaptor class for the Array)
  • New ArrayOf1AsCollectionHolder (to get a CollectionHolder from an Array of 1 value)
  • New ArrayOf2AsCollectionHolder (to get a CollectionHolder from an Array of 2 values)
  • New SetAsCollectionHolder (an adaptor class for the Set)
  • New SetOf1AsCollectionHolder (to get a CollectionHolder from an Set of 1 value)
  • New SetOf2AsCollectionHolder (to get a CollectionHolder from an Set of 2 values)
  • Rename of LazyGenericCollectionHolder to LazyCollectionHolder
  • New LazyCollectionHolderOf1 (to retrieve a single value later in the process)
  • New LazyCollectionHolderOf2 (to retrieve a two values later in the process)
  • New LazyCollectionHolderOf0Or1 (to lazily retrieve 0 or 1 value)
  • New LazyCollectionHolderOf1Or2 (to lazily retrieve 1 or 2 values)
  • New LazyCollectionHolderOf0Or1Or2 (to lazily retrieve 0, 1 or 2 values)

Changes in CollectionIterator

The same size changes are being apply as the CollectionHolder (hasExactly1Element, hasAtMost1Element, hasAtLeast2Elements, hasExactly2Elements & hasAtMost2Elements).
Plus, specific instances for 1 and 2 values are being created as well.

  • New AbstractUnimplementedCollectionIterator (for iterators with specified non-aliased methods)
  • New AbstractCollectionIteratorOf1 (for iterators with only a single value)
  • New AbstractCollectionIteratorOf2 (for iterators with only two values)
  • New CollectionIteratorOf1 (for single value iterator)
  • New CollectionIteratorOf2 (for two values iterator)
  • New interface IteratorValue to improve over the JavaScript juncture plus more methods
  • New interface InsideIteratorValue to give the index being retrieved plus to be an IteratorYieldResult
  • New interface OutsideIteratorValue to give the impossible value plus to be an IteratorResultResult
  • New IteratorValueOf1 (for a single value for an iterator value)
  • New IteratorValueOf1Of2 (for the 1st value out of two values for an iterator value)
  • New IteratorValueOf2Of2 (for the 2nd value out of two values for an iterator value)

Deprecation of the CollectionHandler and its features

Some constants and types are being removed for the unnecessary usage

  • Deprecation of the LazyGenericCollectionHolder in favor of the LazyCollectionHolder
  • Deprecation of the CollectionConstants.EMPTY_COLLECTION_HOLDER in favor of the instance directly (EmptyCollectionHolder.get)
  • Deprecation of the CollectionConstants.LAZY_EMPTY_COLLECTION_HOLDER in favor of the instance directly (EmptyCollectionHolder.get)
  • Deprecation of the CollectionConstants.EmptyCollectionHolder in favor of the constructor instance directly (EmptyCollectionHolder)
  • Deprecation of the CollectionConstants.GenericCollectionHolder in favor of the constructor instance directly (GenericCollectionHolder)
  • Deprecation of the CollectionConstants.GenericMinimalistCollectionHolder in favor of the constructor instance directly (GenericMinimalistCollectionHolder)
  • Deprecation of the CollectionConstants.LazyCollectionHolder in favor of the constructor instance directly (LazyCollectionHolder)

And since new instances are being created, all of the CollectionHandler are being deprecated for the upcoming version 2.1.
This includes:

  • AbstractCollectionHandler (to be replaced with AbstractCollectionHolder)
  • AbstractCollectionHandlerBy1Value (to be replaced with AbstractCollectionHolderOf1)
  • AbstractCollectionHandlerBy2Values (to be replaced with AbstractCollectionHolderOf2)
  • AbstractCollectionHandlerWithIteratbleOrIterator (to be replaced with AbstractCollectionHolder)
  • CollectionHandler (to be replaced with CollectionHolder)
  • EmptyCollectionHandler (to be replaced with EmptyCollectionHolder)
  • CollectionHandlerByArray (to be replaced with ArrayAsCollectionHolder)
  • CollectionHandlerByArrayOf1 (to be replaced with ArrayOf1AsCollectionHolder or CollectionHolderOf1)
  • CollectionHandlerByArrayOf2 (to be replaced with ArrayOf2AsCollectionHolder or CollectionHolderOf2)
  • CollectionHandlerBySet (to be replaced with SetAsCollectionHolder)
  • CollectionHandlerBySetOf1 (to be replaced with SetOf1AsCollectionHolder or CollectionHolderOf1)
  • CollectionHandlerBySetOf2 (to be replaced with SetOf2AsCollectionHolder or CollectionHolderOf2)
  • CollectionHandlerByCollectionHolder (to be replaced with GenericCollectionHolder)
  • CollectionHandlerByCollectionHolderOf1 (to be replaced with CollectionHolderOf1)
  • CollectionHandlerByCollectionHolderOf2 (to be replaced with CollectionHolderOf2)
  • CollectionHandlerByMinimalistCollectionHolder (to be replaced with MinimalistAsCollectionHolder)
  • CollectionHandlerByMinimalistCollectionHolderOf1 (to be replaced with CollectionHolderOf1)
  • CollectionHandlerByMinimalistCollectionHolderOf2 (to be replaced with CollectionHolderOf2)
  • CollectionHandlerByCollectionIterator (to be replaced with IteratorAsCollectionHolder)
  • CollectionHandlerByCollectionIteratorOf1 (to be replaced with CollectionHolderOf1)
  • CollectionHandlerByCollectionIteratorOf2 (to be replaced with CollectionHolderOf2)
  • CollectionHandlerByIterable (to be replaced with JsIterableAsCollectionHolder)
  • CollectionHandlerByIterableWithSize (to be replaced with JsIterableAsCollectionHolder)
  • CollectionHandlerByIterableWithSizeOf1 (to be replaced with CollectionHolderOf1)
  • CollectionHandlerByIterableWithSizeOf2 (to be replaced with CollectionHolderOf2)
  • CollectionHandlerByIterator (to be replaced with JsIteratorAsCollectionHolder)

Other changes

  • Upgrade of the lazy dependency from 1.7.2 to 1.7.3

New Optional and EmptyOptional are being created to replicate the Java Optional.

New Tuple, AbstractTuple, Empty, Monuple and Couple are being created to replicate the tuples in both Kotlin and C# with methods to help utilizing them

Note that typescript has announced its new version 7.0. This will be not present in this release. The next release will include the change.