diff options
Diffstat (limited to 'website2/usageExamples/valExample_pre.jpage')
-rw-r--r-- | website2/usageExamples/valExample_pre.jpage | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/website2/usageExamples/valExample_pre.jpage b/website2/usageExamples/valExample_pre.jpage new file mode 100644 index 00000000..a621640f --- /dev/null +++ b/website2/usageExamples/valExample_pre.jpage @@ -0,0 +1,21 @@ +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()); + } + } +} |