⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pair.java

📁 国外的数据结构与算法分析用书
💻 JAVA
字号:
/**	This class represents a pair of objects. */
public class Pair
{
	/**	The first item of the pair. */
	public Object firstItem;

	/**	The second item of the pair. */
	public Object secondItem;

	/**	Create a pair with initial values v1 and v2. 
		Analysis: Time = O(1) */
	public Pair(Object v1, Object v2)
	{
		firstItem = v1;
		secondItem = v2;
	}

	/**	String representation of the pair.
		Analysis: Time = O(1) */
	public String toString()
	{
		return ( "(" + firstItem + "," + secondItem + ")" );
	}

	/**	Does this pair have equal variable values as the pair referenced by other? 
		Analysis: Time = O(1) */
	public boolean equals(Object other)
	{
		Pair otherPair = (Pair) other;
		return firstItem == otherPair.firstItem && secondItem == otherPair.secondItem;
	}
} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -