Class IntHolder


  • public class IntHolder
    extends Object
    A simple mutable holder for an integer value, providing basic operations like incrementing, setting, and retrieving the value. This class is not thread-safe and should be used in single-threaded contexts or with external synchronization.
    Since:
    1.5.24
    • Field Detail

      • value

        public int value
    • Constructor Detail

      • IntHolder

        public IntHolder​(int value)
        Constructs an IntHolder with the specified initial value.
        Parameters:
        value - the initial integer value to hold
    • Method Detail

      • inc

        public void inc()
        Increments the held value by 1.
      • set

        public void set​(int newValue)
        Sets the held value to the specified new value.
        Parameters:
        newValue - the new integer value to set
      • get

        public int get()
        Returns the current held value.
        Returns:
        the current integer value