mirror of
https://github.com/tiennm99/lombok.git
synced 2026-05-25 17:57:25 +00:00
7dba9c850c
as a gesture to make val less 'magical'. It even works, in eclipse. Next up: javac.
22 lines
489 B
Plaintext
22 lines
489 B
Plaintext
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import lombok.val;
|
|
|
|
public class ValExample {
|
|
public String example() {
|
|
val example = new ArrayList<String>();
|
|
example.add("Hello, World!");
|
|
val foo = example.get(0);
|
|
return foo.toLowerCase();
|
|
}
|
|
|
|
public void example2() {
|
|
val map = new HashMap<Integer, String>();
|
|
map.put(0, "zero");
|
|
map.put(5, "five");
|
|
for (val entry : map.entrySet()) {
|
|
System.out.printf("%d: %s\n", entry.getKey(), entry.getValue());
|
|
}
|
|
}
|
|
}
|