Class Mutable<T>

  • Type Parameters:
    T - The class of object to be wrapped.

    public class Mutable<T>
    extends Object
    Wrapper class to provide mutable object for immutable value.
    • Field Detail

      • val

        public T val
        The wrapped value.
    • Constructor Detail

      • Mutable

        public Mutable()
        Default constructor.
      • Mutable

        public Mutable​(T val)
        Creates a wrapper for val.
        Parameters:
        val - Any object to be wrapped.
    • Method Detail

      • setVal

        public void setVal​(T val)
        Sets the new value for val.
        Parameters:
        val - New value.
      • getVal

        public T getVal()
        Returns the wrapped value.
        Returns:
        Wrapped value.
      • toString

        public String toString()
        Returns the string representation of the val.
        Overrides:
        toString in class Object
        Returns:
        String representation.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object