# emaze-dysfunctional **Repository Path**: mirrors_andyglick/emaze-dysfunctional ## Basic Information - **Project Name**: emaze-dysfunctional - **Description**: An extensive library for Java, providing functional programming features and promoting lazy evaluation wherever possible. - **Primary Language**: Unknown - **License**: BSD-3-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-24 - **Last Updated**: 2026-02-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Changes ## 8.1.0 ### Additions Introduced `Collecting` façade to support additional collectors. * `Collecting.flat` can be used to flat a `Stream` of `Iterable`s, as an example: ``` Stream.of(Arrays.asList(1, 2, 3), Arrays.asList(4, 5)).collect(Collecting.flat()); // yields [1, 2, 3, 4, 5] ``` * `Collecting.reverse` useful to invert the order of a finite stream. ``` Stream.of(1, 2, 3).collect(Collecting.reverse()); // yields [3, 2, 1] ``` Introduced `Strategies` façade with the following methods (:warning: still to test!): * `Function firstMatch(Clause... clauses)` to apply the first clause matching a condition * `Function> maybeFirstMatch(Clause... clauses)` to apply optionally the first clause matching a condition * `Function> allMatches(Clause... clauses)` to apply all clauses matching a condition * also for binary functions Added methods to `Maps` class to transform all keys and/or all values of the passed map, given a mapper function: * `Map mapKeys(Map input, Function keysMapper)` to transform all keys of the passed map applying the passed mapper function * `Map mapKeys(Map input, Function keysMapper, BinaryOperator valueMerger)` to transform all keys of the passed map applying the passed mapper function. If the key is already present into the map, the passed value merger is applied to the value * `Map mapValues(Map input, Function valuesMapper)` to transform all values of the passed map applying the passed mapper function * `Map mapKeysAndValues(Map input, Function keysMapper, Function valuesMapper)` to transform all keys and all values of the passed map applying the passed mapper functions * `Map mapKeysAndValues(Map input, Function keysMapper, Function valuesMapper, BinaryOperator valueMerger)` to transform all keys and all values of the passed map applying the passed mapper functions. If the key is already present into the map, the passed value merger is applied to the value ### Refactors Some better names: * renamed `Multiplexing.batch` in `unchain` (`BatchingIterator` -> `UnchainIterator`) * renamed `Multiplexing.unchain` in `unchainShortest` (`UnchainIterator` -> `UnchainShortestIterator`) * renamed `Multiplexing.unchainWithExactChannelSize` in `unchainLongest` (`UnchainWithExactChannelSizeIterator` -> `UnchainLongestIterator`) `Multiplexing.flatten` and `chain` accepts varargs. ## 8.0 ### Additions Introduced the `Sequences` façade, in order to simplify the usage of sequential streams. A `Sequence` has the following additional methods: * Consumers: `toList`, `toSet`, `toMap`, `first`, `maybeFirst`, `one`, `maybeOne`, `last`, `maybeLast`, `nth`, `maybeNth`, `at`, `maybeAt` * Filtering: `take`, `takeLast`, `takeAtMostLast`, `takeWhile`, `drop`, `dropWhile`, `slice`, `distinctBy` * Multiplexing: `chain` * Applications: `tap` Added the following new methods: * `Optional Either::left()` method to get the left part of the `Either` * `Function, Either> Eithers::lift(Function left, Function right)` to lift functions working on the components of an `Either` into a single function working on either * `Function, Box> Boxes::lift(Function function)` to lift a function to another working on box values * `Maybe Maybes::toMaybe(Optional optional)` to convert an `Optional` to a `Maybe` * `Pair Pair::flip()` * `Triple Triple::flip()` * `Triple Triple::rotateLeft()` * `Triple Triple::rotateRight()` ### Refactors Replaced functional interfaces with built-in ones in package `java.util.function`: * `Delegate` -> `Function` * `BinaryDelegate` -> `BiFunction` * `Provider` -> `Supplier` * `Predicate` -> `Predicate` * `BinaryPredicate` -> `BiPredicate` * `Action` -> `Consumer` * `BinaryAction` -> `BiConsumer` * `Proposition` -> `BooleanSupplier` Used `java.util.Optional` instead of `Maybe`. Uniformed named with standard library: * `Maybe.fmap` -> `Maybe.map` * `Maybe.value` -> `Maybe.get` * `Maybe.hasValue` -> `Maybe.isPresent` * `Box.fmap` -> `Box.map` * `Box.hasContent` -> `Box.isPresent` * `Either.fmap` -> `Either.map` * `Either.maybe` -> `Either.right` * `Pair.fmap` -> `Pair.map` * `Triple.fmap` -> `Triple.map` * `TernaryDelegate` -> `TriFunction` * `TernaryPredicate` -> `TriPredicate` Removed useless functors: * `Identity` -> use `Function.identity()` or `x -> x` * `DropMaybe` -> use `Maybes::drop` * `EitherToMaybe` -> use `Eithers::right` * `PureMaybe` -> use `Optional::of` * `LiftMaybe` -> use `Optional::ofNullable` * `PureEither` -> use `Either::right` * `PureBox` -> use `Box::of` * `MaybeRight` -> use `Eithers::right` * `MaybeOrElse` -> use lambda * `MaybeLeft` -> use `Either::left` * `MaybeIteratorTransformer` -> use `MaybeIterator::new` * `IsNothing` -> use `Maybes::isEmpty` * `IsJust` -> use `Optional::isPresent` * `FromJust` -> use `Optional::get` * `FmapMaybe` -> invoke `Maybes.lift` * `FMapBox` -> invoke `Boxes.lift` * `FlipEither` -> use `Either::flip` * `FlipPair` -> use `Pair::flip` * `FlipTriple` -> use `Triple::flip` * `PairFirst` -> use `Pair::first` * `PairSecond` -> use `Pair::second` * `TripleFirst` -> use `Triple::first` * `TripleSecond` -> use `Triple::second` * `TripleThird` -> use `Triple::third` * `TripleRotateLeft` -> use `Triple::rotateLeft` * `TripleRotateRight` -> use `Triple::rotateRight` * `Max` -> use `BinaryOperator.maxBy` * `Min` -> use `BinaryOperator.minBy` * `Negator` -> invoke `predicate.negate()` * `Equals` -> invoke `Predicate.isEqual()` * `NotEquals` -> invoke `Predicate.isEqual().negate()` * `HasNext` -> use `Iterator::hasNext` * `IteratorPlucker` -> use `Iterable::iterator` * `ClassPlucker` -> use `Object::getClass`