collections-by: source generator maven plugin

Functions for working with Iterables and Sequeneces

License

License

Categories

Categories

Maven Build Tools Net
GroupId

GroupId

net.onedaybeard.collections-by
ArtifactId

ArtifactId

generator-maven-plugin
Last Version

Last Version

0.1.2
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

collections-by: source generator maven plugin
Functions for working with Iterables and Sequeneces
Project URL

Project URL

https://github.com/junkdog/collections-by
Source Code Management

Source Code Management

https://github.com/junkdog/collections-by/

Download generator-maven-plugin

How to add to project

<plugin>
    <groupId>net.onedaybeard.collections-by</groupId>
    <artifactId>generator-maven-plugin</artifactId>
    <version>0.1.2</version>
</plugin>

Dependencies

compile (4)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib jar 1.4.32
org.jetbrains.kotlin : kotlin-reflect jar 1.4.32
org.apache.maven : maven-plugin-api jar 3.6.1
org.apache.maven : maven-core jar 3.6.1

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.6.0

Project Modules

There are no modules declared in this project.

collections-by - extensions for Sequence and Iterable

Provides overloaded functions - for Iterable, Sequenece, List and Array - taking a predicate. Overloaded functions take an additional selector parameter, in addition to predicate or object to match. E.g.findBy, removeAllBy.

Two overloads are generated for each function and underlying collection:

  • with selector and object-to-equal
  • with selector and predicate
// same set of overloads are also generated for Sequence, Array etc
fun <T, U> List<T>.findBy(selector: (T) -> U, predicate: (U) -> Boolean): List<T>
fun <T, U> List<T>.findBy(selector: (T) -> U, match: U): List<T>

// usage
people.findBy(Person::surname, "Papari")
people.findBy(Person::surname) { name -> name == "Papari" }

Usage

Current $VERSION is 0.1.0-SNAPSHOT

Maven

<dependency>
    <groupId>net.onedaybeard.collections-by</groupId>
    <artifactId>core</artifactId>
    <version>${VERSION}</version>
</dependency>

Gradle

implementation "net.onedaybeard.collections-by:core:${VERSION}"

Direct download

$ java -ea -javaagent:agent-${VERSION}.jar ...

Versions

Version
0.1.2