History variables: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
m (→‎{{header|Java}}: fix several markup problems)
Line 1,093: 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.
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}}===
===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).
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;
<syntaxhighlight lang="java">import java.util.Collections;
Line 1,210: Line 1,210:
</pre>
</pre>


==={{header|Java History for "any class" using Generics}}===
===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).
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":
Test Program using a "String with History":
<syntaxhighlight lang="java">import java.util.Collections;
<syntaxhighlight lang="java">import java.util.Collections;