Class IntHolder

java.lang.Object
ch.qos.logback.core.util.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 Summary

    Fields
    Modifier and Type
    Field
    Description
    int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    IntHolder(int value)
    Constructs an IntHolder with the specified initial value.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    get()
    Returns the current held value.
    void
    inc()
    Increments the held value by 1.
    void
    set(int newValue)
    Sets the held value to the specified new value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • value

      public int value
  • Constructor Details

    • IntHolder

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

    • 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