collections-by

Functions for working with Iterables and Sequeneces

License

License

Categories

Categories

Net
GroupId

GroupId

net.onedaybeard.collections-by
ArtifactId

ArtifactId

collections-by
Last Version

Last Version

0.1.2
Release Date

Release Date

Type

Type

pom
Description

Description

collections-by
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 collections-by

Filename Size
collections-by-0.1.2.pom 9 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/net.onedaybeard.collections-by/collections-by/ -->
<dependency>
    <groupId>net.onedaybeard.collections-by</groupId>
    <artifactId>collections-by</artifactId>
    <version>0.1.2</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/net.onedaybeard.collections-by/collections-by/
implementation 'net.onedaybeard.collections-by:collections-by:0.1.2'
// https://jarcasting.com/artifacts/net.onedaybeard.collections-by/collections-by/
implementation ("net.onedaybeard.collections-by:collections-by:0.1.2")
'net.onedaybeard.collections-by:collections-by:pom:0.1.2'
<dependency org="net.onedaybeard.collections-by" name="collections-by" rev="0.1.2">
  <artifact name="collections-by" type="pom" />
</dependency>
@Grapes(
@Grab(group='net.onedaybeard.collections-by', module='collections-by', version='0.1.2')
)
libraryDependencies += "net.onedaybeard.collections-by" % "collections-by" % "0.1.2"
[net.onedaybeard.collections-by/collections-by "0.1.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • core
  • generator-maven-plugin

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