diff options
Diffstat (limited to 'website/usageExamples/experimental/varExample_pre.jpage')
-rw-r--r-- | website/usageExamples/experimental/varExample_pre.jpage | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/website/usageExamples/experimental/varExample_pre.jpage b/website/usageExamples/experimental/varExample_pre.jpage new file mode 100644 index 00000000..e58c4c0d --- /dev/null +++ b/website/usageExamples/experimental/varExample_pre.jpage @@ -0,0 +1,21 @@ +import java.util.ArrayList; +import lombok.var; + +public class VarExample { + public String example() { + var example = new ArrayList<String>(); + example.add("Hello, World!"); + final var foo = example.get(0); + return foo.toLowerCase(); + } + + public void example2() { + var list = new ArrayList<String>(); + list.add("zero"); + list.add("one"); + list.add("two"); + for(var i = 0; i < list.size(); ++i) { + System.out.printf("%d: %s\n", i, list.get(i)); + } + } +} |