Immutability, part 2: Creating a simple immutable stack – SLaks.Blog
Immutability, part 2: Creating a simple immutable stack
Posted on Sunday, June 23, 2013Last time, I explained the basic meaning of immutability. The simplest useful example of an immutable class is an immutable stack. Immutable stacks work just like regular stacks – with Push()
, Pop()
, and Peek()
methods – except that instead of mutating the original instance, Push()
and Pop()
return a new, modified, instance.
Read full article from Immutability, part 2: Creating a simple immutable stack – SLaks.Blog
No comments:
Post a Comment