unorderedpair.java
来自「Standord Classifier实现了一个基于Java的最大熵分类器。用于」· Java 代码 · 共 42 行
JAVA
42 行
package edu.stanford.nlp.util;import java.util.*;/** * Unordered Pair * * Class for holding an unordered pair of objects * * @author Dan Klein * @version 2/7/01 */public class UnorderedPair extends Pair { public String toString() { return "{"+first+","+second+"}"; } public boolean equals(Object o) { if (o instanceof UnorderedPair) { UnorderedPair p = (UnorderedPair)o; return (((first==null ? p.first==null : first.equals(p.first)) && (second==null ? p.second==null : second.equals(p.second))) || ((first==null ? p.second==null : first.equals(p.second)) && (second==null ? p.first==null : second.equals(p.first)))); } return false; } public int hashCode() { return first.hashCode() ^ second.hashCode(); } public UnorderedPair() {first = null; second = null;} public UnorderedPair(Object first, Object second) { this.first = first; this.second = second; } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?