An open API service indexing awesome lists of open source software.

https://github.com/lucassklp/jinq

Java Integrated Query - LINQ for Java Programmers
https://github.com/lucassklp/jinq

java java-8 lambda linq linq-methods

Last synced: 2 months ago
JSON representation

Java Integrated Query - LINQ for Java Programmers

Awesome Lists containing this project

README

        

# jinq - Java Integrated Query - LINQ for Java

This library is inspired in [LINQ - Method Syntax (C#)](https://docs.microsoft.com/en-us/dotnet/csharp/linq/write-linq-queries) and helps Java programmers to manipulate list and its elements.

Examples of use:

```java
QueryableList users = new QueryableList<>();

users.add(new User(10, "Tom", "[email protected]", 40.2F));
users.add(new User(26, "Clark", "[email protected]", 62.7F));
users.add(new User(52, "Marie", "[email protected]", 54.7F));
users.add(new User(37, "Peter", "[email protected]", 87.7F));
users.add(new User(10, "Cleber", "[email protected]", 47.7F));
users.add(new User(10, "John", "[email protected]", 50.7F));

//Do the Map operation over user list
QueryableList map = users.map(x -> x.getAge());

//Find the first element that matches with predicate
User ageTen = users.find(x -> x.getAge() == 10);

//Find all elements that matches with predicate
QueryableList listAgeTen = users.findAll(x -> x.getAge() == 10);

//Remove all elements that matches with predicate
users.removeAll(x -> x.getAge() == 10);

//Remove first elements that matches with predicate
users.remove(x -> x.getEmail().equals("[email protected]"));

//Group the list by age
QueryableList> ageGroup = Group.of(users, it -> it.getAge());

//Get the max value from List
User older = users.max(x -> x.getAge());

//Get the max value from List
User newer = users.min(x -> x.getAge());

```