Package tenapull.util

Class Var<T>

java.lang.Object
tenapull.util.Var<T>
Type Parameters:
T - the type being wrapped
Direct Known Subclasses:
Var.String

public class Var<T>
extends java.lang.Object
Wraps a value of any type (T). Used mainly so that a lambda may mutate the value of a variable in the outer scope, because lambdas require that an outer variable be 'final or effectively final' if it is to be accessible from within the lambda. An instance of var satisfies this requirement while allowing its 'value' property to be mutated.

Also includes static-inner-class wrappers of each primitive type

  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  Var.Bool
    Var which wraps a boolean primitive
    static class  Var.Byte
    Var which wraps a byte primitive
    static class  Var.Char
    Var which wraps a char primitive
    static class  Var.Double
    Var which wraps a double primitive
    static class  Var.Float
    Var which wraps a float primitive
    static class  Var.Int
    Var which wraps an int primitive
    static class  Var.Long
    Var which wraps a long primitive
    static class  Var.Short
    Var which wraps a short primitive
    static class  Var.String
    Var which wraps a String
  • Field Summary

    Fields 
    Modifier and Type Field Description
    T value
    The value this Var wraps
  • Constructor Summary

    Constructors 
    Constructor Description
    Var()
    Instantiates a new Var with a default value of null
    Var​(T initialValue)
    Instantiates a new Var with the provided initial value
  • Method Summary

    Methods inherited from class java.lang.Object

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

    • value

      public T value
      The value this Var wraps
  • Constructor Details

    • Var

      public Var()
      Instantiates a new Var with a default value of null
    • Var

      public Var​(T initialValue)
      Instantiates a new Var with the provided initial value
      Parameters:
      initialValue - the initial value