Skip to content

Pair ​

com.jsmacrosce.Pair

Stores two mutable values in positional order: T is first and U is second.

js
const Pair = Java.type("com.jsmacrosce.Pair");  
const pair = new Pair("first", 2);  
pair.getT(); // "first"
pair.getU(); // 2

Type Parameters ​

  • T: the type of the first value
  • U: the type of the second value

Constructors ​

new Pair ​

new Pair(T t, U u)#
Stores the supplied first and second values, respectively.

Parameters:

  • t: the first value
  • u: the second value

Methods ​

getT ​

getT(): T#
Returns the first stored value, which may be null if null was stored.
Returns: the first stored value

getU ​

getU(): U#
Returns the second stored value, which may be null if null was stored.
Returns: the second stored value

setT ​

setT(T t): void#
Replaces the first stored value.

Parameters:

  • t: the new first value

setU ​

setU(U u): void#
Replaces the second stored value.

Parameters:

  • u: the new second value