Popularity
1.0
Stable
Activity
0.0
Stable
19
1
3

Programming language: Java
License: MIT License
Tags: Animations     Java     Android-library     Linq     Collections     ArrayList    
Latest version: v1.1.0

LinqArraylist alternatives and similar packages

Based on the "Animations" category.
Alternatively, view LinqArraylist alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of LinqArraylist or a related project?

Add another 'Animations' Package

README

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]
    }