Package smile.util

Class MutableInt

java.lang.Object
smile.util.MutableInt

public class MutableInt extends Object
A mutable int wrapper. It is efficient as counter in HashMap.
  • Field Details

    • value

      public int value
      The integer value.
  • Constructor Details

    • MutableInt

      public MutableInt()
      Constructor. The initial value is 1 since we're counting.
    • MutableInt

      public MutableInt(int value)
      Constructor.
      Parameters:
      value - the initial value.
  • Method Details

    • increment

      public int increment()
      Increment by one.
      Returns:
      the update value.
    • increment

      public int increment(int x)
      Increment.
      Parameters:
      x - the operand.
      Returns:
      the update value.
    • decrement

      public int decrement()
      Decrement by one.
      Returns:
      the update value.
    • decrement

      public int decrement(int x)
      Decrement.
      Parameters:
      x - the operand.
      Returns:
      the update value.