Class MutableInteger


  • public class MutableInteger
    extends java.lang.Object
    A mutable integer
    Author:
    bratseth
    • Constructor Summary

      Constructors 
      Constructor Description
      MutableInteger​(int value)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int add​(int increment)
      Adds the increment to the current value and returns the resulting value
      int get()  
      int next()
      Increments the value by 1 and returns the value of this *before* incrementing
      void set​(int value)  
      int subtract​(int increment)
      Adds the increment to the current value and returns the resulting value
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MutableInteger

        public MutableInteger​(int value)
    • Method Detail

      • get

        public int get()
      • set

        public void set​(int value)
      • add

        public int add​(int increment)
        Adds the increment to the current value and returns the resulting value
      • next

        public int next()
        Increments the value by 1 and returns the value of this *before* incrementing
      • subtract

        public int subtract​(int increment)
        Adds the increment to the current value and returns the resulting value
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object