All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.groupbyinc.common.jackson.jq.internal.misc.Pair Maven / Gradle / Ivy

There is a newer version: 198
Show newest version
package net.thisptr.jackson.jq.internal.misc;

import java.util.ArrayList;
import java.util.List;

public class Pair {
	public final T _1;
	public final U _2;

	public Pair(final T _1, final U _2) {
		this._1 = _1;
		this._2 = _2;
	}

	public static  Pair of(final T _1, final U _2) {
		return new Pair<>(_1, _2);
	}

	public static  List _1(final List> items) {
		final List result = new ArrayList<>(items.size());
		for (final Pair item : items)
			result.add(item._1);
		return result;
	}

	public static  List _2(final List> items) {
		final List result = new ArrayList<>(items.size());
		for (final Pair item : items)
			result.add(item._2);
		return result;
	}

	@Override
	public String toString() {
		return String.format("(%s, %s)", _1, _2);
	}
}