This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
commit 2728eab88800438471dc5841fefe2c3252d7f7f1
tree e61ae58ca9cea17a79d639ffc1a2f27f788e8898
parent 6eb723a2fedc5b3ad49af43e9c6660e609c32e55
tree e61ae58ca9cea17a79d639ffc1a2f27f788e8898
parent 6eb723a2fedc5b3ad49af43e9c6660e609c32e55
| name | age | message | |
|---|---|---|---|
| |
.classpath | ||
| |
.gitignore | ||
| |
.project | ||
| |
.settings/ | ||
| |
CONTRIBUTORS | ||
| |
MIT-LICENSE | ||
| |
README.markdown | ||
| |
pom.xml | ||
| |
src/ |
README.markdown
Collect4j
Collect4j is an DSL (Domain Specific Language) for manipulates Java Collections API. Simple Commands do filter and access values in a collection.
Using
Add the jar file collect4j-X.X.jar to your classpath, or dowload from maven repositories (repo1)
Supports
- eql for equals comparision
- like for string content
- supports generics (objects is supported too)
- comparates some fields (Only for your custom class)
TODO
- Implements more Collection searchs
- Map and Set Implementations
Usage Samples
- Simple Collections
List list = new ArrayList(); list.add("Uva"); list.add("Maça"); list.add("Melancia"); list.add("Melão"); list.add("Maracujá"); Collection busca = (Collection) new Collect().in(lista).when().like("Mel", "Ma"); //Search in the collection when the content contatis the passed string.
Generics Collections
public class Person{
String name;
int age;
public Person() {
super();
}
public Person(String name, int age) {
super();
this.name = name;
this.age = age;
}
//Getters and setters
/**
* Some cases the to string is used too
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Person["+name+", "+age+" ]";
}
}
List<Person> persons = new ArrayList<Person>();
persons.add(new Person("Rafael", 21));
persons.add(new Person("Suélen", 19));
persons.add(new Person("Pedro", 23));
persons.add(new Person("Rodrigo", 23));
Collection<Person> busca = (Collection<Person>) new Collect().in(persons).when("age").eql("23");//Compare with the field age is equals to 23, and return a new collection
Collection<Person> busca = (Collection<Person>) new Collect().in(persons).when().eql("23");//Compare the Person#toString() contais the string "23"








