Skip to content

Releases: aol/cyclops-integration

9.0.0-MI7 Release of Cyclops : integration for cylcops-react 2.0.0-FINAL

06 Aug 21:13
Compare
Choose a tag to compare

9.0.0-MI7 Release of Cyclops

Upgrade to cyclops-rect 2.0.0-FINAL

AnyM bug fix

Getting Cyclops 9.0.0-MI7

MODULE_NAMES : cyclops-scala, cyclops-clojure, cyclops-dexx, cyclops-rx, cyclops-reactor, cyclops-guava, cyclops-functionaljava, cyclops-vavr, cyclops-rxjava2

Gradle

       compile 'com.aol.cyclops:MODULE_NAME:9.0.0-MI7’

Maven

     <dependency>
           <groupId>com.aol.cyclops</groupId>
           <artifactId>MODULE_NAME</artifactId>
           <version>9.0.0-MI7</version>
     </dependency>

Javadoc

http://www.javadoc.io/doc/com.aol.cyclops/cyclops-scala/9.0.0-MI7
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-clojure/9.0.0-MI7
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-dexx/9.0.0-MI7
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-rx/9.0.0-MI7
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-rxjava2/9.0.0-MI7
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-reactor/9.0.0-MI7
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-vavr/9.0.0-MI7
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-functionaljava/9.0.0-MI7
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-guava/9.0.0-MI7

v9.0.0-MI6 - Higher Kinded functional programming!

07 Jul 14:59
Compare
Choose a tag to compare

9.0.0-MI6 Release of Cyclops

This simplifies the package structure to make it easier to find the key components

Using Typeclasses (examples for Vavr)

Directly

Typeclasses can be used directly (although this results in verbose and somewhat cumbersome code)
e.g. using the Pure and Functor typeclasses for Vavr Streams

   Pure<stream> pure = Streams.Instances.unit();
   Functor<stream> functor = Streams.Instances.functor();
        
   StreamKind<Integer> stream = pure.unit("hello")
                                  .applyHKT(h->functor.map((String v) ->v.length(), h))
                                  .convert(StreamKind::narrowK);

        
   assertThat(list.toJavaList(),equalTo(Arrays.asList("hello".length())));

Via Active

The Active class represents a Higher Kinded encoding of a Vavr (or cyclops-react/ JDK/ reactor / rx etc) type and it's associated type classes

The code above which creates a new Stream containing a single element "hello" and transforms it to Stream of Integers (the length of each word), can be written much more succintly with Active

Active<stream,Integer> active = Streams.allTypeClasses(Stream.empty());

Active<stream,Integer> hello = active.unit("hello")
                                     .map(String::length);

Stream<Integer> stream = StreamKind.narrow(hello.getActive());

Via Nested

The Nested class represents a Nested data structure, for example a List of Options and the associated typeclass instances for both types.

import cyclops.companion.vavr.Options.OptionNested;

Nested<option,list,Integer> optList  = OptionNested.list(Option.some(List.ofAll(1,10,2,3)))
                                                                       .map(i -> i * 20);

Option<Integer> opt  = optList.foldsUnsafe()
                              .foldLeft(Monoids.intMax)
                              .convert(OptionKind::narrowK);


//[200]

Via Coproduct

Coproduct is a Sum type for HKT encoded types that also stores the associated type classes

import static 
Coproduct<list,option,Integer> nums = Options.coproduct(10,Lists.Instances.definitions());


int value = nums.map(i->i*2)
                .foldUnsafe()
                .foldLeft(0,(a,b)->a+b);

//20

Getting Cyclops 9.0.0-MI6

MODULE_NAMES : cyclops-scala, cyclops-clojure, cyclops-dexx, cyclops-rx, cyclops-reactor, cyclops-guava, cyclops-functionaljava, cyclops-vavr, cyclops-rxjava2

Gradle

       compile 'com.aol.cyclops:MODULE_NAME:9.0.0-MI6’

Maven

     <dependency>
           <groupId>com.aol.cyclops</groupId>
           <artifactId>MODULE_NAME</artifactId>
           <version>9.0.0-MI6</version>
     </dependency>

Javadoc

http://www.javadoc.io/doc/com.aol.cyclops/cyclops-scala/9.0.0-MI6
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-clojure/9.0.0-MI6
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-dexx/9.0.0-MI6
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-rx/9.0.0-MI6
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-rxjava2/9.0.0-MI6
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-reactor/9.0.0-MI6
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-vavr/9.0.0-MI6
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-functionaljava/9.0.0-MI6
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-guava/9.0.0-MI6

v9.0.0-MI2 of cyclops - Better type conversions and structure

08 Jun 22:08
Compare
Choose a tag to compare

9.0.0-MI2 Release of Cyclops

This simplifies the package structure to make it easier to find the key components

  • Companion classes for 3d party types (e.g. checkout Lists, Eithers, Trys, Vectors and so on)
  • Conversion classes between 3rd party types
  • Witness classes for higher level monad support

This makes it easier to extract native collections when working with Lazy / Reactive Xtended Collections
e.g.

Xtended Collections

Create and convert a Vavr Vector via Xtended Collections

Vector<Integer> vector = VectorX.of(1, 2, 3)
                                .type(VavrTypes.vector())
                                .map(i -> i * 2)
                                .to(VavrConverters::Vector);

Asynchronously populate a Vavr Vector

 VectorX<Integer> vectorX = Spouts.reactive(Stream.of(1, 2, 3),Executors.newFixedThreadPool(1))
                                  .to()
                                  .vectorX(LAZY)
                                  .type(VavrTypes.vector())
                                  .map(this::expensiveOp);

/** Continue processing **/

vectorX.get(1); //blocking operation until data loaded

//or unwrap back to Vavr

Vector<Integer> vavr = vector.to(VavrConverters::Vector);

Monad Transformers

 ListT<option,Integer> vectorInOption = ListT.ofList(Vavr.option(Option.some(VavrVectorX.of(10))));


        ListT<option,Integer> doubled = vectorInOption.map(i->i*2);
        ListT<option,Integer> repeated = doubled.cycle(3);

        System.out.println(repeated);
    
        //ListT[Some([20, 20, 20])]
        
        Option<Vector<Integer>> list = option(vectorInOption.unwrap()).map(s -> s.to()
                                                                      .vectorX(LAZY)
                                                                      .to(VavrConverters::Vector));

Overview of 9.0.0-MI2

[Milestone issues and PRs[(https://github.com/aol/cyclops/milestone/46?closed=1)

Getting Cyclops 9.0.0-MI2

MODULE_NAMES : cyclops-scala, cyclops-clojure, cyclops-dexx, cyclops-rx, cyclops-reactor, cyclops-guava, cyclops-functionaljava, cyclops-javaslang, cyclops-sum-types, cyclops-higherkindedtypes, cyclops-typeclasses

Gradle

       compile 'com.aol.cyclops:MODULE_NAME:9.0.0-MI2’

Maven

     <dependency>
           <groupId>com.aol.cyclops</groupId>
           <artifactId>MODULE_NAME</artifactId>
           <version>9.0.0-MI2</version>
     </dependency>

Javadoc

http://www.javadoc.io/doc/com.aol.cyclops/cyclops-scala/9.0.0-MI2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-clojure/9.0.0-MI2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-dexx/9.0.0-MI2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-rx/9.0.0-MI2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-reactor/9.0.0-MI2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-javaslang/9.0.0-MI2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-functionaljava/9.0.0-MI2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-guava/9.0.0-MI2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-sum-types/9.0.0-MI2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-higherkindedtypes/9.0.0-MI2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-typeclasses/9.0.0-MI2

v9.0.0-MI1 of cyclops : Upgrade to cyclops-react 2

09 May 15:29
Compare
Choose a tag to compare

9.0.0-MI1 Release of Cyclops

Upgrades cyclops integration modules to cyclops-react v2

Overview of 9.0.0-MI1

  • Lazy, reactive wrappers for persistent collection types from Javaslang / Vavr, Scala, Clojure and more
  • Type safe abstractions across any third party monad types
  • Companion classes (Options, Trys, Eithers, Lists) for functional types from third party libraries with for comprehensions and conversions

Getting Cyclops 9.0.0-MI1

MODULE_NAMES : cyclops-scala, cyclops-clojure, cyclops-dexx, cyclops-rx, cyclops-reactor, cyclops-guava, cyclops-functionaljava, cyclops-javaslang, cyclops-sum-types, cyclops-higherkindedtypes, cyclops-typeclasses

Gradle

       compile 'com.aol.cyclops:MODULE_NAME:9.0.0-MI1’

Maven

     <dependency>
           <groupId>com.aol.cyclops</groupId>
           <artifactId>MODULE_NAME</artifactId>
           <version>9.0.0-MI1</version>
     </dependency>

Javadoc

http://www.javadoc.io/doc/com.aol.cyclops/cyclops-scala/9.0.0-MI1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-clojure/9.0.0-MI1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-dexx/9.0.0-MI1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-rx/9.0.0-MI1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-reactor/9.0.0-MI1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-javaslang/9.0.0-MI1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-functionaljava/9.0.0-MI1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-guava/9.0.0-MI1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-sum-types/9.0.0-MI1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-higherkindedtypes/9.0.0-MI1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-typeclasses/9.0.0-MI1

v7.2.4 : cyclops-try flatten bug fix

12 Apr 13:59
Compare
Choose a tag to compare

7.2.4 Release of Cyclops

This is a bug fix for the legacy 7.2.x version of cyclops. Fixes aol/cyclops#258

8.2.x is the latest release

Getting Cyclops 7.2.4

cyclops-all has all non-integration modules, but each module can be used / added individually (subject to it's own dependencies). Instructions for each module are in it's own readme.md.

Gradle

       compile 'com.aol.cyclops:cyclops-all:7.2.4'

Maven

     <dependency>
           <groupId>com.aol.cyclops</groupId>
           <artifactId>cyclops-all</artifactId>
           <version>7.2.4</version>
     </dependency>

http://www.javadoc.io/doc/com.aol.cyclops/cyclops-sequence-api/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-streams/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-monad-api/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-monad-functions/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-mixins/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-invokedynamic/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-for-comprehensions/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-functions/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-try/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/pattern-matching/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-trampoline/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-feature-toggle/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-core/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-tuples/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-all/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-javaslang/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-functionaljava/7.2.4
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-guava/7.2.4

v8.4.2 of cyclops : Fix for for comprehensions for Javaslang Either

12 Apr 09:25
Compare
Choose a tag to compare

8.4.2 Release of Cyclops

aol/cyclops#259 : Javaslang Either For Comprehension Fix

Overview of 8.4.0

Cyclops 8.4.2 offers a smorgasord of Lazy Extended Persistent collections, choose between PCollections, Scala, Clojure, Dexx and JavaSlang for your Lazy eXtended Persistent Collections with a common interface across them all.

cyclops-scala

Use Scala Persistent Collections directly from Java, without the pain of $colon.$colon.$plus syntax and canBuildFrom complexity.

e.g.

ScalaPVector.of(1,2,3)
            .map(i->i*2)
            .plus(5);

ScalaPVector.empty()
            .onEmptySwitch(() -> ScalaPVectorX.of(1, 2, 3);

Interoperate with Collections from Clojure, PCollections, Dexx and JavaSlang

ScalaPPStack.of(1,2,3)
            .flatMap(i->ClojurePVector.range(0,i)
            .plus(5);

Getting Cyclops 8.4.2

MODULE_NAMES : cyclops-scala, cyclops-clojure, cyclops-dexx, cyclops-rx, cyclops-reactor, cyclops-guava, cyclops-functionaljava, cyclops-javaslang, cyclops-sum-types, cyclops-higherkindedtypes, cyclops-typeclasses

Gradle

       compile 'com.aol.cyclops:MODULE_NAME:8.4.2’

Maven

     <dependency>
           <groupId>com.aol.cyclops</groupId>
           <artifactId>MODULE_NAME</artifactId>
           <version>8.4.2</version>
     </dependency>

Javadoc

http://www.javadoc.io/doc/com.aol.cyclops/cyclops-scala/8.4.2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-clojure/8.4.2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-dexx/8.4.2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-rx/8.4.2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-reactor/8.4.2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-javaslang/8.4.2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-functionaljava/8.4.2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-guava/8.4.2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-sum-types/8.4.2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-higherkindedtypes/8.4.2
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-typeclasses/8.4.2

v8.4.1 of cyclops adds an Either5 and various performance enhancements for working with collections

06 Dec 14:55
Compare
Choose a tag to compare

8.4.1 Release of Cyclops

Issues and PRs for 8.4.1

Enhancements in 8.4.1

Sum types

  1. Either5 added
  2. Native for comprehensions added (forEach2-4)
  3. applyAny, consumeAny fluent method execution

Collection performance

  1. Cross-thread lazy collection materialization has spin locking
  2. plusLoop operators to append directly to Scala collections in a loop

Overview of 8.4.0

Cyclops 8.4.1 offers a smorgasord of Lazy Extended Persistent collections, choose between PCollections, Scala, Clojure, Dexx and JavaSlang for your Lazy eXtended Persistent Collections with a common interface across them all.

cyclops-scala

Use Scala Persistent Collections directly from Java, without the pain of $colon.$colon.$plus syntax and canBuildFrom complexity.

e.g.

ScalaPVector.of(1,2,3)
            .map(i->i*2)
            .plus(5);

ScalaPVector.empty()
            .onEmptySwitch(() -> ScalaPVectorX.of(1, 2, 3);

Interoperate with Collections from Clojure, PCollections, Dexx and JavaSlang

ScalaPPStack.of(1,2,3)
            .flatMap(i->ClojurePVector.range(0,i)
            .plus(5);

Getting Cyclops 8.4.1

MODULE_NAMES : cyclops-scala, cyclops-clojure, cyclops-dexx, cyclops-rx, cyclops-reactor, cyclops-guava, cyclops-functionaljava, cyclops-javaslang, cyclops-sum-types, cyclops-higherkindedtypes, cyclops-typeclasses

Gradle

       compile 'com.aol.cyclops:MODULE_NAME:8.4.1’

Maven

     <dependency>
           <groupId>com.aol.cyclops</groupId>
           <artifactId>MODULE_NAME</artifactId>
           <version>8.4.1</version>
     </dependency>

Javadoc

http://www.javadoc.io/doc/com.aol.cyclops/cyclops-scala/8.4.1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-clojure/8.4.1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-dexx/8.4.1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-rx/8.4.1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-reactor/8.4.1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-javaslang/8.4.1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-functionaljava/8.4.1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-guava/8.4.1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-sum-types/8.4.1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-higherkindedtypes/8.4.1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-typeclasses/8.4.1

v8.4.0 of cyclops : Extended Persistent Collections from Scala, Clojure, JavaSlang and Dexx

29 Nov 11:12
Compare
Choose a tag to compare

8.4.0 Release of Cyclops

Issues and PRs for 8.4.0

Overview of 8.4.0

Cyclops 8.4.0 offers a smorgasord of Lazy Extended Persistent collections, choose between PCollections, Scala, Clojure, Dexx and JavaSlang for your Lazy eXtended Persistent Collections with a common interface across them all.

cyclops-scala

Use Scala Persistent Collections directly from Java, without the pain of $colon.$colon.$plus syntax and canBuildFrom complexity.

e.g.

ScalaPVector.of(1,2,3)
            .map(i->i*2)
            .plus(5);

ScalaPVector.empty()
            .onEmptySwitch(() -> ScalaPVectorX.of(1, 2, 3);

Interoperate with Collections from Clojure, PCollections, Dexx and JavaSlang

ScalaPPStack.of(1,2,3)
            .flatMap(i->ClojurePVector.range(0,i)
            .plus(5);

Getting Cyclops 8.4.0

MODULE_NAMES : cyclops-scala, cyclops-clojure, cyclops-dexx, cyclops-rx, cyclops-reactor, cyclops-guava, cyclops-functionaljava, cyclops-javaslang, cyclops-sum-types, cyclops-higherkindedtypes, cyclops-typeclasses

Gradle

       compile 'com.aol.cyclops:MODULE_NAME:8.4.0’

Maven

     <dependency>
           <groupId>com.aol.cyclops</groupId>
           <artifactId>MODULE_NAME</artifactId>
           <version>8.4.0</version>
     </dependency>

Javadoc

http://www.javadoc.io/doc/com.aol.cyclops/cyclops-scala/8.4.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-clojure/8.4.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-dexx/8.4.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-rx/8.4.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-reactor/8.4.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-javaslang/8.4.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-functionaljava/8.4.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-guava/8.4.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-sum-types/8.4.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-higherkindedtypes/8.4.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-typeclasses/8.4.0

v8.3.0 of cyclops : Sum Types (Eithers), Higher Kinded Types and Type Classes

25 Nov 23:22
Compare
Choose a tag to compare

8.3.0 Release of Cyclops

Javadoc enhancements for the 8.3.0 release

Issues and PRs for 8.3.0

Overview of 8.3.0

3 new modules

cyclops-sum-types

Introduces 3 new data structures - Either. Either3 and Either 4. All are totally lazy ‘right’ biased union or Either types. Like Xor (an eager sum type) they inherit from ApplicativeFunctor, Filterable, Foldable, Functor, MonadicValue1, To, Value,Visitable and Zippable.

cyclops-higherkindedtypes

Introduces derive4j as a dependency and defines ‘type constructors’ for JDK types. All cyclops integration modules import cyclops-higherkindedtypes and we provide Higher Kinded Type encodings for the types in those libraries (e.g. FunctionalJava, JavaSlang, Guava, Reactor, RxJava). HKT encodings are HighJ compatible and we also provide a set of type classes in cyclops-typeclasses

cyclops-typeclasses

Defines a set of type classess (Functor, Applicative, Monad, Traversable etc) and Instances for JDK and cyclops-react types. Each third party integration module provides their own type class instances.

I

Getting Cyclops 8.3.0

MODULE_NAMES : cyclops-rx, cyclops-reactor, cyclops-guava, cyclops-functionaljava, cyclops-javaslang, cyclops-sum-types, cyclops-higherkindedtypes, cyclops-typeclasses

Gradle

       compile 'com.aol.cyclops:MODULE_NAME:8.3.0’

Maven

     <dependency>
           <groupId>com.aol.cyclops</groupId>
           <artifactId>MODULE_NAME</artifactId>
           <version>8.3.0</version>
     </dependency>

Javadoc

http://www.javadoc.io/doc/com.aol.cyclops/cyclops-rx/8.3.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-reactor/8.3.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-javaslang/8.3.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-functionaljava/8.3.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-guava/8.3.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-sum-types/8.3.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-higherkindedtypes/8.3.0
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-typeclassess/8.3.0 (note the misspelling which will be fixed in 8.3.1 - the extra s at the end).

v8.2.1 of cyclops :- Javadoc enhancements

26 Oct 14:04
Compare
Choose a tag to compare

8.2.1 Release of Cyclops

Javadoc enhancements for the 8.2.0 release

[Issues and PRs for 8.2.1](https://github.com/aol/cyclops/milestone/39?closed=100

Overview of 8.2.0

Integration module enhancements

Reactor

  • Lazy extended Collections
  • Lazy persistent extended Collections
  • Streaming Utilities - Pipes and FluxSource for 'pushable' Streams
  • For comprehension syntax / API enhancement
  • Native Monad Transformers for Monos
  • Native for comprehensions for MonoT types
  • Version bump to Reactor 3!

RxJava

  • For comprehension syntax / API enhancement

Lazy extended Collections

Standard JDK collections

  1. LazyListX
  2. LazyDequeX
  3. LazyQueueX
  4. LazySetX
  5. LazySortedX

Persistent collections

  1. LazyPStackX (A persistent LinkedList)
  2. LazyPVectorX (A persistent Vector - an ArrayList analogue)
  3. LazyPQueueX (A persistent Queue)
  4. LazyPSetX (A persistent Set)
  5. LazyPOrderedSetX (A persistent OrderedSet)
  6. LazyPBagX (A persistent Bag)

Notes :

  1. Lazy collections can not contain nulls (extended operations will result in NullPointerException), use ListX from cyclops-react for an extended List that can contain nulls
  2. Data access / modifications operations are eager (transformations are lazy)
  3. A Lazy Collection is not a Stream, eager operations result in the materialization of the entire list (there is no short circuiting, for example)

LazyListX

LazyListX extends ListX from cyclops-react (and JDK java.util.List).

    ListX<Integer> lazy = LazyListX.fromIterable(myIterable);

    //lazily define operations
    ListX<ListX<Integer>> transformed = lazy.map(i->i*2)
                                            .filter(i->i<100)
                                            .grouped(2);

    //operations performed when data is accessed
    transformed.get(0).reduce(0,(a,b)->a+b);

Notes : (repeated for LazyListX only - holds for all)

  1. LazyListX can not contain nulls (extended operations will result in NullPointerException), use ListX from cyclops-react for an extended List that can contain nulls
  2. Data access / modifications operations are eager (transformations are lazy)
  3. A LazyList is not a Stream, eager operations result in the materialization of the entire list (there is no short circuiting, for example)

LazyDequeX

LazyDequeX extends DequeX from cyclops-react (and JDK java.util.Deque).

    DequeX<Integer> lazy = LazyDequeX.fromIterable(myIterable);

    //lazily define operations
    DequeX<ListX<Integer>> transformed = lazy.map(i->i*2)
                                            .filter(i->i<100)
                                            .grouped(2);

    //operations performed when data is accessed
    transformed.get(0).reduce(0,(a,b)->a+b);

LazyQueueX

LazyQueueX extends QueueX from cyclops-react (and JDK java.util.Deque).

    QueueX<Integer> lazy = LazyQueueX.fromIterable(myIterable);

    //lazily define operations
    LazyQueueX<ListX<Integer>> transformed = lazy.map(i->i*2)
                                                 .filter(i->i<100)
                                                 .sliding(2,1);

    //operations performed when data is accessed
    transformed.get(0).reduce(0,(a,b)->a+b);

FluxSource

For pushing data into Flux and Mono types

    PushableFlux<Integer> pushable = FluxSource.ofUnbounded();
    pushable.getQueue()
            .offer(1);

    //on a separate thread
    pushable.getFlux()
            .map(i->i*2)
            .subscribe(System.out::println);

    //then push data into your Flux
    pushable.getQueue()
            .offer(2);

    //close the transfer Queue
     pushable.getQueue()
             .close();

Documentation for StreamSource (cyclops-react / extended JDK analogue of FluxSource)

Blog post on pushing data into Java 8 Streams

Documentation for working with Queues

Joining Streams with ReactorPipes

ReactorPipes provides an API for flexible joining of multple different Stream types.

    ReactorPipes<String,Integer> pipes = ReactorPipes.of();

    //store a transfer Queue with a max size of 1,000 entries
    pipes.register("transfer1",QueueFactories.boundedQueue(1_000));

    //connect a Flux to transfer1
    Maybe<Flux<Integer>> connected = pipes.flux("transfer1");
    Flux<Integer> stream = connected.get();

    //Setup a producing Stream
    ReactiveSeq seq = ReactiveSeq.generate(this::loadData)
                                 .map(this::processData);


    pipes.publishToAsync("transfer1",seq);

    stream.map(e->handleNextElement(e))
          .subscribe(this::save);

Example for comprehensions with Flux

import static com.aol.cyclops.reactor.Fluxes.forEach;

Flux<Integer> result = forEach(Flux.just(10,20),a->Flux.<Integer>just(a+10)
                                             ,(a,b)->a+b);

//Flux[30,50]

Example for comprehensions with Mono

import static com.aol.cyclops.reactor.Monos.forEach;

Mono<Integer> result = forEach(Mono.just(10),a->Mono.<Integer>just(a+10)
                                          ,(a,b)->a+b);

//Mono[30]

FluxT monad transformer

import static com.aol.cyclops.reactor.FluxTs.fluxT;

FluxTSeq<Integer> nested = fluxT(Flux.just(Flux.just(1,2,3),Flux.just(10,20,30)));
FluxTSeq<Integer> mapped = nested.map(i->i*3);

//mapped = [Flux[Flux[3,6,9],Flux30,60,90]]

MonoT monad transformer

import static com.aol.cyclops.reactor.MonoTs.monoT;

MonoTSeq<Integer> nestedFuture = monoT(Flux.just(Mono.just(1),Mono.just(10)));
mapped = nested.map(i->i*3);

//mapped =  [Flux[Mono[3],Mono[30]]

Getting Cyclops 8.2.1

MODULE_NAMES : cyclops-rx, cyclops-reactor, cyclops-guava, cyclops-functionaljava, cyclops-javaslang

Gradle

       compile 'com.aol.cyclops:MODULE_NAME:8.2.1’

Maven

     <dependency>
           <groupId>com.aol.cyclops</groupId>
           <artifactId>MODULE_NAME</artifactId>
           <version>8.2.1</version>
     </dependency>

Javadoc

http://www.javadoc.io/doc/com.aol.cyclops/cyclops-rx/8.2.1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-reactor/8.2.1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-javaslang/8.2.1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-functionaljava/8.2.1
http://www.javadoc.io/doc/com.aol.cyclops/cyclops-guava/8.2.1