com.ibm.wala.util.collections.Pair Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.ibm.wala.util Show documentation
Show all versions of com.ibm.wala.util Show documentation
T. J. Watson Libraries for Analysis
The newest version!
/*
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*/
package com.ibm.wala.util.collections;
import com.ibm.wala.util.debug.Assertions;
import java.io.Serializable;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Objects;
public class Pair implements Serializable {
private static final long serialVersionUID = 1861211857872739247L;
public final T fst;
public final U snd;
protected Pair(T fst, U snd) {
this.fst = fst;
this.snd = snd;
}
private static boolean check(Object x, Object y) {
return Objects.equals(x, y);
}
@SuppressWarnings("rawtypes")
@Override
public boolean equals(Object o) {
return (o instanceof Pair) && check(fst, ((Pair) o).fst) && check(snd, ((Pair) o).snd);
}
private static int hc(Object o) {
return (o == null) ? 0 : o.hashCode();
}
@Override
public int hashCode() {
return hc(fst) * 7219 + hc(snd);
}
public Iterator
© 2015 - 2025 Weber Informatics LLC | Privacy Policy