History variables: Difference between revisions

m
→‎{{header|Java}}: fix several markup problems
m (syntax highlighting fixup automation)
m (→‎{{header|Java}}: fix several markup problems)
Line 1,093:
Java does not support history variables, but they are easy to implement using the lists that come with Java's Collections framework.
 
==={{header|Java Integer with History}}===
This implementation does not allow the History Variable to be "empty". It can be assigned one or multiple "nulls", but it can never have an undefined value (such as being created and not initialized).
<syntaxhighlight lang="java">import java.util.Collections;
Line 1,210:
</pre>
 
==={{header|Java History for "any class" using Generics}}===
This implementation does not allow the History Variable to be "empty". It can be assigned one or multiple "nulls", but it can never have an undefined value (such as being created and not initialized).
<syntaxhighlight lang="java"></syntaxhighlight>
Test Program using a "String with History":
<syntaxhighlight lang="java">import java.util.Collections;
10,327

edits