Linq-like functions for Java Arraylist

Overview

LinqArraylist

Download Android Arsenal
use Linq-like functions to Java Collections

    implementation 'gr.loukaspd:LinqArraylist:{latest version}'

where {latest version} corresponds to published version in Download Android Arsenal

Usage

  1. Instantiate a LinqArrayList object by passing it your original Collection
  2. Apply linq methods (even chaining) like select, where etc..
  3. Get the resulting Collection by calling getCollection or getArrayList() to get a new ArrayList from the collection

Examples

public static void main(String[] args) {
        ArrayList<SampleClass> myList = new ArrayList<>();
        myList.add(new SampleClass(1, "red"));
        myList.add(new SampleClass(2, "green"));
        myList.add(new SampleClass(3, "blue"));


        ArrayList<SampleClass> result = new LinqArrayList<>(myList)
                .where(new LinqArrayList.BooleanFunc<SampleClass>() {
                    @Override
                    public boolean lambda(SampleClass item) {
                        return item.id > 1;
                    }
                })
                .getArrayList();
        System.out.println(result);   //[2: green, 3: blue]

        System.out.println(new LinqArrayList<>(myList)
                .firstOrDefault(new LinqArrayList.BooleanFunc<SampleClass>() {
                    @Override
                    public boolean lambda(SampleClass item) {
                        return item.color.equals("red");
                    }
                }));    //1: red


        // chaining
        System.out.println(
                new LinqArrayList<>(myList)
                .where(new LinqArrayList.BooleanFunc<SampleClass>() {
                    @Override
                    public boolean lambda(SampleClass item) {
                        return item.id > 1;
                    }
                })
                .select(new LinqArrayList.SelectFunc<SampleClass, String>() {
                    @Override
                    public String lambda(SampleClass item) {
                        return item.color;
                    }
                })
                .getArrayList()
        );          //[green, blue]
    }
You might also like...
Uber - Android application like uber dummy
Uber - Android application like uber dummy

UBER! Uploading Screenshot_20220113-191606_Uber.jpg… About Android application l

Kendo is like a long night, and learning is similar

Sword Come 🌈 For English vocabulary analysis and sentence analysis in natural language, model training, intelligent response and emotion analysis rea

Discode - Discord-like app that executes code in messages
Discode - Discord-like app that executes code in messages

Like Discord, but you can paste and run code in the chat About This is a Discord

🚀🧨📝 Series of Tutorials to learn about Jetpack Compose with subjects Material Widgets, Layout, SubcomposeLayout, custom layouts, State, custom rememberable, recomposition, LaunchedEffect, side-effects, Gesture, Animation,  Navigation, Canvas, UIs like whatsapp and others.
Tool for exporting Old School RuneScape environments so they can be used in 3D modeling programs like Blender.

OSRS Environment Exporter Tool for exporting Old School RuneScape environments so that they can be used in 3D modeling programs like Blender. Download

My own approach to what I think an Android MVVM project with Clean Architecture should look like with Dagger-Hilt as Dependency Injector engine
My own approach to what I think an Android MVVM project with Clean Architecture should look like with Dagger-Hilt as Dependency Injector engine

MVVM Project Hilt Introducción Este proyecto es mi visión particular, ni mejor ni peor (sólo una más) que cualquier otra aproximación a lo que yo enti

Comparison among Java, Groovy, Scala, Kotlin in Android Development.

中文版 日本語 AndroidDemoIn4Languages A simple Android application written in Java, Groovy, Scala and Kotlin in order to find out what is the better languag

Archimedes's implementation for the Java Virtual Machine (JVM)

Archimedes Give me a place to stand, and I shall move the earth. Archimedes's implementation for the Java Virtual Machine (JVM) Building From Source T

An example project for configuring Rust with Java 18's Panama/jextract

rust-panama A template project for setting up both Rust and the Java 18 Panama Foreign Linker API (via jextract). How to Setup Clone the repo. Modify

Releases(1.1.0)
Owner
null
Kotlin extensions, BindingAdapters, Composable functions for Android CameraX

Setup dependencies { implementation "com.github.skgmn:cameraxx:0.6.0" } Features CameraXX provides extensions methods for CameraX to use functions

null 12 Aug 9, 2022
Esito ambition is to be your return type for suspending functions.

Esito ambition is to be your return type for suspending functions.

null 58 Oct 21, 2022
An annotation processor library that automatically creates Hilt's `@Binds` functions and modules.

HiltBinder An annotation processor library that automatically creates Hilt's @Binds functions and modules. If you think this library is useful, please

SangMin Park 5 Sep 19, 2022
A ksp library to automatically generate navigation functions for jetpack compose.

Compose/Navigation/Generator ⚠️ This library is still under development and not considered stable! Content Introduction Usage Example: Single destinat

Steffen Eckardt 4 Sep 13, 2022
🧮 Provides simple and advanced mathematical functions in a beautifully designed UI.

Calculator ?? Android App ?? Download the App ?? What is this App ✍️ This will basically provide simple and advanced mathematical functions in a beaut

Ayush Agnihotri 9 Jan 31, 2023
This is a practice app. An app that you can find random recipes and choose the ones you like.

A food suggestion app like Tinder This is a practice app. In this app, you can find random recipes and choose the ones you like. This is main menu. Yo

Yunus Emre OCAK 4 May 25, 2022
An Online Meme Sharing app with swipeable vidoes, user can like, share different videos, each viewpager item has one video to show.

MemesSharing An Online Meme Sharing app with swipeable vidoes, user can like, share different videos, each viewpager item has one video to show. 1. Fl

Vikas Bajpayee 13 Aug 6, 2022
In this Repo i create public apis to serve apps, like muslim apps using Spring, kotlin, and microservices

spring-freelance-apis-kotlin In this Repo i create public apis to serve apps, like muslim apps using Spring, kotlin, and microservices This repo for l

null 6 Feb 13, 2022
Kotlin compiler plugin that allows class delegation to be dynamic like property delegations

kotlin-dynamic-delegation Kotlin compiler plugin that allows class delegation to be dynamic like property delegations. The plugin is working in progre

Him188 14 Sep 8, 2022