https://github.com/be-hase/lamtils
lamtils
https://github.com/be-hase/lamtils
Last synced: 3 months ago
JSON representation
lamtils
- Host: GitHub
- URL: https://github.com/be-hase/lamtils
- Owner: be-hase
- License: mit
- Created: 2016-05-16T02:42:37.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-19T05:21:36.000Z (about 9 years ago)
- Last Synced: 2025-01-18T08:18:05.633Z (4 months ago)
- Language: Java
- Size: 70.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://circleci.com/gh/be-hase/lamtils)
[](https://maven-badges.herokuapp.com/maven-central/com.be-hase.lamtils/lamtils)# Lamtils
## Lamtils ?
Lamtils(LAMbda uTILS) is (lambda's)expression utility library for Creating map and POJO(JavaBeans).
Look this sample !
Creating HashMap :
```java
@Test
public void test_newHashMap() {
Map result;
Date now = new Date();result = Lamtils.newHashMap(
one -> "one",
two -> 2,
three -> now,
four -> 4.0
);
assertThat(result, instanceOf(HashMap.class));
assertThat(result, hasEntry("one", "one"));
assertThat(result, hasEntry("two", 2));
assertThat(result, hasEntry("three", now));
assertThat(result, hasEntry("four", 4.0));
}
```Creating POJO(Java bean):
(Setter method is needed.)```java
@Test
public void test_newClass() {
TestPojo result;
Date now = new Date();result = Lamtils.newClass(
TestPojo.class,
one -> "one",
two -> 2,
three -> now,
four -> 4.0,
five -> true
);
assertThat(result, instanceOf(TestPojo.class));
assertThat(result.getOne(), is("one"));
assertThat(result.getTwo(), is(2));
assertThat(result.getThree(), is(now));
assertThat(result.getFour(), is(4.0));
assertThat(result.isFive(), is(true));
}public static class TestPojo {
private String one;
private int two;
private Date three;
private double four;
private boolean five;// And setter/getter methods
}
```## Attention
This is not good for performance.
I think that it is better for using only test code.## Requirements
* Need "-parameters" option on javac