
org.eclipse.collections.api.tuple.Pair Maven / Gradle / Ivy
/*
* Copyright (c) 2015 Goldman Sachs.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*/
package org.eclipse.collections.api.tuple;
import java.io.Serializable;
import java.util.Map;
/**
* A Pair is a container that holds two related objects. It is the equivalent of an Association in Smalltalk, or an
* implementation of Map.Entry in the JDK.
*/
public interface Pair
extends Serializable, Comparable>
{
T1 getOne();
T2 getTwo();
void put(Map map);
Map.Entry toEntry();
/**
* Method used to swap the elements of pair.
*
*
e.g.
* Pair<String, Integer> pair = Tuples.pair("One", 1);
* Pair<Integer, String> swappedPair = pair.swap();
*
*
* @since 6.0
*/
Pair swap();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy