📄 pair.java
字号:
/**
* @(#)Pair.java 1.10 03/01/23
*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.sun.tools.javac.v8.util;
/**
* A generic class for pairs.
*/
public class Pair {
public final Object fst;
public final Object snd;
public Pair(Object fst, Object snd) {
super();
this.fst = fst;
this.snd = snd;
}
private static boolean equals(Object x, Object y) {
return (x == null && y == null) || (x != null && x.equals(y));
}
public boolean equals(Object other) {
return other instanceof Pair && equals(fst, ((Pair) other).fst) &&
equals(snd, ((Pair) other).snd);
}
public int hashCode() {
if (fst == null)
return snd.hashCode() + 1;
else if (snd == null)
return fst.hashCode() + 2;
else
return fst.hashCode() * snd.hashCode();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -