diff options
Diffstat (limited to 'usage_examples/valExample_pre.jpage')
-rw-r--r-- | usage_examples/valExample_pre.jpage | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/usage_examples/valExample_pre.jpage b/usage_examples/valExample_pre.jpage new file mode 100644 index 00000000..8b9dadc3 --- /dev/null +++ b/usage_examples/valExample_pre.jpage @@ -0,0 +1,20 @@ +import java.util.ArrayList; +import java.util.HashMap; + +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()); + } + } +} |