Pair

When you want to store two objects together

Creation

Make sure you import Pair by doing the following:

var Pair = Java.type("dev.cedo.tuples.Pair")
var Pair = Java.type("dev.cedo.tuples.Pair")

var script = initScript({
    name: "Test Script",
    description: "This is a test",
    author: "cedo"
})

var color1 = script.colorSetting("Color1", color({red: 255, green: 90, blue: 0}))
var color2 = script.colorSetting("Color2", color({red: 30, green: 190, blue: 90}))

script.onRender2D(function(event) {
    var customPair = Pair.of(color1.getColor(), color2.getColor())
})

Functions

of

var customPair = Pair.of(color1.getColor(), color2.getColor())
//OR
var customPair = Pair.of(color1.getColor())

Will create a pair of the objects specified

getFirst

var firstObj = customPair.getFirst()

Returns the first object in the Pair

getSecond

var secondObj = customPair.getSecond()

Returns the second object in the Pair

Last updated